Skip to content

Support single Python version (3.12) and move rewriting stuff from warc2zim to zimscraperlib #200

Support single Python version (3.12) and move rewriting stuff from warc2zim to zimscraperlib

Support single Python version (3.12) and move rewriting stuff from warc2zim to zimscraperlib #200

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches:
- main
jobs:
generate-rules:
runs-on: ubuntu-24.04
steps:
- 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:
- 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:
- 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:
- uses: actions/checkout@v4
- name: Restore rules artifact
uses: actions/download-artifact@v4
with:
name: rules
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version-file: 'javascript/package.json'
registry-url: 'https://registry.npmjs.org'
- run: yarn install
working-directory: javascript
- run: yarn pack
working-directory: javascript
- run: npm publish $(ls *.tgz) --dry-run --provenance --access public
working-directory: javascript
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}