Skip to content

Merge pull request #204 from openzim/content_rewriting #219

Merge pull request #204 from openzim/content_rewriting

Merge pull request #204 from openzim/content_rewriting #219

Workflow file for this run

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 }}
- name: Ensure we can build Python targets
run: |
pip install -U pip build
python3 -m build --sdist --wheel
run-js-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: 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: Run JS tests
working-directory: javascript
run: yarn test
- name: Ensure we can build development JS
run: yarn build-dev
working-directory: javascript
- name: Ensure we can build production JS
run: yarn build-prod
working-directory: javascript
- name: Ensure we can build JS package
run: yarn pack
working-directory: javascript