Add failing unit tests #204
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: CI | |
on: | |
push: | |
jobs: | |
python-wheel: | |
name: 🏗️ Python wheel | |
strategy: | |
matrix: | |
python: | |
- '3.8' | |
- '3.9' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 🧰 Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: 🧰 Install dependencies | |
run: | | |
python -m pip install --upgrade pip build twine | |
- name: 🏗️ Build Python wheel | |
run: python -m build | |
- name: 🧪 Check package bundles | |
run: twine check dist/* | |
- name: ℹ️ List Python wheels | |
if: matrix.python == '3.9' && matrix.os == 'ubuntu-latest' | |
run: ls -R | |
working-directory: dist | |
- name: 📤 Upload Python wheel | |
uses: actions/upload-artifact@v4 | |
if: matrix.python == '3.9' && matrix.os == 'ubuntu-latest' | |
with: | |
name: wheel | |
path: dist | |
docker-build: | |
name: 🏗️ Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 🧰 Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: 🧰 Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: 🚀 Build image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
python-code-format: | |
name: 🔍 Python code format | |
strategy: | |
matrix: | |
python: | |
- '3.8' | |
- '3.9' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 🧰 Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: 🧰 Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install .[test] | |
- name: 🔍 Check Python code format | |
run: flake8 ir_axioms/ tests/ | |
python-lint: | |
name: 🔍 Python Lint | |
strategy: | |
matrix: | |
python: | |
- '3.8' | |
- '3.9' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 🧰 Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: 🧰 Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install .[test] | |
- name: 🔍 Lint Python code | |
run: pylint -E ir_axioms tests.unit --ignore-paths="^ir_axioms.backend|^ir_axioms.cli" | |
python-lint-backend: | |
name: 🔍 Python Lint backend | |
strategy: | |
matrix: | |
python: | |
- '3.8' | |
- '3.9' | |
backend: | |
- pyserini | |
- pyterrier | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 🧰 Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: 🧰 Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install .[test] | |
pip install .[${{ matrix.backend }}] | |
- name: 🧰 Install Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: 🔍 Lint Python code | |
run: pylint -E ir_axioms.backend.${{ matrix.backend }} tests.integration.${{ matrix.backend }} ${{ matrix.backend == 'pyterrier' && 'ir_axioms.cli' || '' }} | |
python-unit-tests: | |
name: 🧪 Python unit tests | |
strategy: | |
matrix: | |
python: | |
- '3.8' | |
- '3.9' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 🧰 Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: 🧰 Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install .[test] | |
- name: 🧪 Test Python code | |
run: pytest --cov=./ --cov-report=xml ir_axioms/ tests/unit/ --ignore=ir_axioms/backend/ --ignore=ir_axioms/cli.py | |
- name: 📤 Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
if: matrix.python == '3.9' && matrix.os == 'ubuntu-latest' | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
python-integration-tests: | |
name: 🧪 Python integration tests | |
strategy: | |
matrix: | |
python: | |
- '3.8' | |
- '3.9' | |
backend: | |
- pyserini | |
- pyterrier | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 🧰 Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: 🧰 Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install .[test] | |
pip install .[${{ matrix.backend }}] | |
- name: 🧰 Install Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: 🧪 Test Python code | |
run: pytest --cov=./ --cov-report=xml tests/integration/${{ matrix.backend }}/ ${{ matrix.backend == 'pyterrier' && 'ir_axioms/cli.py' || '' }} | |
- name: 📤 Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
if: matrix.python == '3.9' && matrix.os == 'ubuntu-latest' | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
publish-package: | |
name: 🚀 Publish Python wheels | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && endsWith(github.event.base_ref, 'main') | |
needs: | |
- python-wheel | |
- docker-build | |
- python-code-format | |
- python-lint | |
- python-lint-backend | |
- python-unit-tests | |
- python-integration-tests | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 📥 Download Python wheels | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheel | |
path: dist | |
- name: ℹ️ List Python wheels | |
run: ls -R | |
working-directory: dist | |
- name: 🚀 Publish Python wheels | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
docker-push: | |
name: 🚀 Publish Docker image | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && endsWith(github.event.base_ref, 'main') | |
permissions: | |
packages: write | |
needs: | |
- python-wheel | |
- docker-build | |
- python-code-format | |
- python-lint | |
- python-lint-backend | |
- python-unit-tests | |
- python-integration-tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 🧰 Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: 🧰 Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: 🔑 Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: 🔑 Login to GitHub Packages | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: ℹ️ Extract image metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
webis/ir_axioms | |
ghcr.io/${{ github.repository }} | |
- name: 🚀 Build and push image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
github-release: | |
name: 🚀 Create GitHub release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && endsWith(github.event.base_ref, 'main') | |
needs: | |
- python-wheel | |
- docker-build | |
- python-code-format | |
- python-lint | |
- python-lint-backend | |
- python-unit-tests | |
- python-integration-tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Check-out | |
uses: actions/checkout@v4 | |
- name: 📥 Download Python wheels | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheel | |
path: dist | |
- name: ℹ️ List Python wheels | |
run: ls -R | |
working-directory: dist | |
- name: 🚀 Create GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Release ${{ github.ref_name }} | |
files: dist/* | |
fail_on_unmatched_files: true | |
draft: false | |
prerelease: false | |
generate_release_notes: true |