Skip to content

Commit

Permalink
Merge pull request #47 from openzim/issue_46
Browse files Browse the repository at this point in the history
Migrate to our new Python standard + Zimscraperlib 3.1 + fix few issues
  • Loading branch information
benoit74 authored Jul 25, 2023
2 parents 3adfca2 + 9e4a610 commit 9448d0b
Show file tree
Hide file tree
Showing 47 changed files with 1,321 additions and 287 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Tests

on:
pull_request:
push:
branches:
- main

jobs:
run-tests:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml
architecture: x64

- name: Install dependencies (and project)
run: |
pip install -U pip
pip install -e .[test,scripts]
- name: Run the tests
run: inv coverage --args "-vvv"

- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Ensure we can build targets
run: |
pip install build
python3 -m build
29 changes: 0 additions & 29 deletions .github/workflows/docker.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and upload to PyPI

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-22.04
permissions:
id-token: write # mandatory for PyPI trusted publishing

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml
architecture: x64

- name: Build packages
run: |
pip install -U pip build
python -m build sdist wheel
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.8

- name: Build and push Docker image
uses: openzim/docker-publish-action@v10
with:
image-name: openzim/kolibri
tag-pattern: /^v([0-9.]+)$/
latest-on-tag: true
restrict-to: openzim/kolibri
registries: ghcr.io
credentials:
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
repo_description: auto
repo_overview: auto
10 changes: 10 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Pull Request

on:
pull_request:

jobs:
qa:
uses: ./.github/workflows/qa.yml
# run qa job if the pull request originates from a fork (otherwise the qa is already triggered by the push to a branch)
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
8 changes: 8 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Push

on:
push:

jobs:
qa:
uses: ./.github/workflows/qa.yml
31 changes: 31 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: QA

on:
workflow_call:

jobs:
check-qa:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml
architecture: x64

- name: Install dependencies (and project)
run: |
pip install -U pip
pip install -e .[lint,check,scripts,test]
- name: Check black formatting
run: inv lint-black

- name: Check ruff
run: inv lint-ruff

- name: Check pyright
run: inv check-pyright
Loading

0 comments on commit 9448d0b

Please sign in to comment.