Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
zhPavel committed Mar 4, 2024
1 parent b26f17e commit 4dd0eaa
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 15 additions & 12 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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 }}


9 changes: 9 additions & 0 deletions scripts/invoke_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 4dd0eaa

Please sign in to comment.