Support single Python version (3.12) and move rewriting stuff from warc2zim to zimscraperlib #208
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
generate-rules: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: pyproject.toml | |
architecture: x64 | |
- name: Install dependencies (and project) | |
run: | | |
pip install -U pip | |
pip install -e .[scripts] | |
- name: Generate rules | |
run: | | |
python rules/generate_rules.py | |
- name: Save rules artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
src/zimscraperlib/rewriting/rules.py | |
tests/rewriting/test_fuzzy_rules.py | |
javascript/src/fuzzyRules.js | |
javascript/test/fuzzyRules.js | |
name: rules | |
retention-days: 1 | |
run-python-tests: | |
runs-on: ubuntu-24.04 | |
needs: generate-rules | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Restore rules artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: rules | |
- name: install ffmpeg and gifsicle | |
run: sudo apt update && sudo apt install ffmpeg gifsicle | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
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 "--runslow --runinstalled -vvv" | |
- name: Upload coverage report to codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build_python: | |
runs-on: ubuntu-24.04 | |
needs: generate-rules | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Restore rules artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: rules | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
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_javascript: | |
runs-on: ubuntu-24.04 | |
needs: generate-rules | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Restore rules artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: rules | |
- name: Setup Node.JS | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'javascript/package.json' | |
- name: Install JS dependencies | |
run: yarn install | |
working-directory: javascript | |
- name: Build development JS | |
run: yarn build-dev | |
working-directory: javascript | |
- name: Build production JS | |
run: yarn build-prod | |
working-directory: javascript | |
- name: Build JS package | |
run: yarn pack | |
working-directory: javascript |