diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml index 9d80f041..937b719d 100644 --- a/.github/workflows/lint_and_test.yml +++ b/.github/workflows/lint_and_test.yml @@ -82,13 +82,15 @@ jobs: - name: Run tests run: - just test-with-coverage ${{ matrix.python_version.tox }} + just inv test-on-ci \ + --py-target {{ matrix.python_version.tox }} \ + --cov-output .coverage.${{ matrix.python_version }} - name: Store coverage file uses: actions/upload-artifact@v4 with: name: coverage-${{ matrix.python_version.setup }} - path: coverage.db + path: .coverage.${{ matrix.python_version }} if-no-files-found: error coverage: diff --git a/justfile b/justfile index bc7a25e0..b6b893a0 100644 --- a/justfile +++ b/justfile @@ -17,11 +17,6 @@ set windows-powershell := true pip-sync requirements/pre.txt requirements/dev.txt pip install -e . -[private] -@setup-runner: - pip install -r requirements/pre.txt - pip install -r requirements/runner.txt - # run all linters @lint: tox -e lint @@ -38,18 +33,12 @@ set windows-powershell := true @test-all: tox -e $(tox list --no-desc | grep '^py' | sort -r | tr '\n' ',') -p auto -# run all tests on specific python version with coverage -@test-with-coverage target: - {{ inv }} cov \ - --env-list $(tox list --no-desc | grep '^{{ target }}' | sort -r | tr '\n' ',') \ - --output coverage.db - inv := "inv -r scripts -c invoke_tasks" @cov: {{ inv }} cov \ --env-list $(tox list --no-desc | grep -e '^py' | sort -r | tr '\n' ',') \ - --output coverage.db \ + --output coverage.xml \ --parallel @deps-compile: @@ -69,3 +58,17 @@ doc_target := "docs-build" # clean generated documentation and build cache @doc-clean: sphinx-build -M clean {{ doc_source }} {{ doc_target }} + + +# Continious integration + +[private] +@setup-runner: + pip install -r requirements/pre.txt + pip install -r requirements/runner.txt + +[private] +@inv *ARGS: + {{ inv }} {{ ARGS }} + + diff --git a/scripts/invoke_tasks.py b/scripts/invoke_tasks.py index cb477723..1021d05e 100644 --- a/scripts/invoke_tasks.py +++ b/scripts/invoke_tasks.py @@ -56,3 +56,12 @@ def deps_compile(c: Context, upgrade=False): for file in Path(".").glob("requirements/*.txt"): c.run(fr'sed -i -E "s/-e file:.+\/tests\/tests_helpers/-e .\/tests\/tests_helpers/" {file}') c.run(fr'sed -i -E "s/-e file:.+\/benchmarks/-e .\/benchmarks/" {file}') + + +@task +def test_on_ci(c: Context, py_target, cov_output): + env_list = c.run(fr"tox list --no-desc | grep '^{py_target}' | sort -r | tr '\n' ','", hide=True).stdout + if 'pypy' in py_target: + c.run(fr"tox -e {env_list}", pty=True) + else: + cov(c, env_list=env_list, output=cov_output)