fix failing test test_pipeline_with_documents
#1632
Workflow file for this run
This file contains hidden or 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: Code Quality and Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main, "release/*"] | |
env: | |
FORCE_COLOR: "1" | |
jobs: | |
pre-commit: | |
name: Pre-commit | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up python environment | |
uses: ./.github/actions/init-env | |
with: | |
os: "ubuntu-latest" | |
python: "3.10" | |
- name: Compute pre-commit cache key | |
id: pre-commit-cache | |
shell: python | |
run: | | |
import hashlib | |
import sys | |
import os | |
python = "py{}.{}".format(*sys.version_info[:2]) | |
payload = sys.version.encode() + sys.executable.encode() | |
digest = hashlib.sha256(payload).hexdigest() | |
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8]) | |
with open(os.environ['GITHUB_OUTPUT'], 'a') as f: f.write(f"result={result}\n") | |
- name: Restore pre-commit cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ steps.pre-commit-cache.outputs.result }}- | |
- name: Run pre-commits | |
run: | | |
source .venv/bin/activate | |
pre-commit run -a | |
shell: bash | |
pytest: | |
name: Pytest ${{ matrix.python }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { python: "3.10", os: "ubuntu-latest" } | |
# - { python: "3.10", os: "macos-latest" } | |
# - { python: "3.10", os: "windows-latest" } | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up python environment | |
uses: ./.github/actions/init-env | |
with: | |
os: ${{ matrix.os }} | |
python: ${{ matrix.python }} | |
# If this is a push to the main branch, run all tests (including slow ones). | |
- name: Run all tests with coverage | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
run: | | |
source .venv/bin/activate | |
pytest --cov --cov-report=xml:coverage.xml --cov-report=term-missing --typeguard-packages=pytorch-ie | |
# Otherwise skip slow tests | |
- name: Run 'not slow' tests with coverage | |
if: github.event_name != 'push' || github.ref_name != 'main' | |
run: | | |
source .venv/bin/activate | |
pytest -m "not slow" --cov --cov-report=xml:coverage.xml --cov-report=term-missing --typeguard-packages=pytorch-ie | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.xml | |
fail_ci_if_error: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |