Skip to content

Commit

Permalink
Merge pull request #96 from openzim/migrate_to_conventions
Browse files Browse the repository at this point in the history
Upgrade scraper (Python conventions, Python version and dependencies)
  • Loading branch information
benoit74 authored Mar 2, 2024
2 parents a14ce78 + 7370031 commit 1983d98
Show file tree
Hide file tree
Showing 131 changed files with 2,420 additions and 1,614 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/Publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish released version

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/ifixit
tag-pattern: /^v([0-9.]+)$/
latest-on-tag: true
restrict-to: openzim/ifixit
registries: ghcr.io
credentials:
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
repo_description: auto
repo_overview: auto
27 changes: 27 additions & 0 deletions .github/workflows/PublishDockerDevImage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Docker dev image

on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Build and push Docker image
uses: openzim/docker-publish-action@v10
with:
image-name: openzim/ifixit
manual-tag: dev
latest-on-tag: false
restrict-to: openzim/ifixit
registries: ghcr.io
credentials:
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
repo_description: auto
repo_overview: auto
34 changes: 34 additions & 0 deletions .github/workflows/QA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: QA

on:
pull_request:
push:
branches:
- main

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,scripts,test,check]
- name: Check black formatting
run: inv lint-black

- name: Check ruff
run: inv lint-ruff

- name: Check pyright
run: inv check-pyright
62 changes: 62 additions & 0 deletions .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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 }}

build_python:
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: Ensure we can build Python targets
run: |
pip install -U pip build
python3 -m build --sdist --wheel
build_docker:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Ensure we can build the Docker image
run: |
docker build -t testimage .
- name: Ensure we can start the Docker image
run: |
docker run --rm testimage
38 changes: 0 additions & 38 deletions .github/workflows/qa.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/release.yml

This file was deleted.

Loading

0 comments on commit 1983d98

Please sign in to comment.