From 4e61453a53b1775057ea309d979a651d61897c3d Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Mon, 23 Sep 2024 20:10:00 +0200 Subject: [PATCH] quality-checks.yml: Employs the python-build-and-inspect-python-package action --- .github/workflows/quality-checks.yml | 34 ++++++++++++++++++++-------- Justfile | 4 ++-- pyproject.toml | 7 ++++++ 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index 8d80b357..d78279f2 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -22,16 +22,24 @@ on: jobs: + build: + runs-on: ubuntu-latest + outputs: + python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }} + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref || github.ref }} + - uses: hynek/build-and-inspect-python-package@v2 + id: baipp + unit-tests: + needs: ["build"] runs-on: ubuntu-latest strategy: matrix: - python-version: - - 3.8 # 2024-10 - - 3.9 # 2025-10 - - "3.10" # 2026-10 - - "3.11" # 2027-10 - - "3.12" # 2028-10 + python-version: ${{ fromJson(needs.build.outputs.python-versions) }} steps: - uses: actions/checkout@v4 with: @@ -40,8 +48,16 @@ jobs: with: python-version: ${{ matrix.python-version }} - uses: extractions/setup-just@v2 - - run: pip install hatch - - run: just pytest + - run: pipx install hatch + - uses: actions/download-artifact@v4 + with: + name: Packages + path: dist + - run: | + rm -r _delb delb + test "$(find dist -name 'delb-*.whl' | wc -l)" -eq 1 + export WHEEL_PATH=$(find dist -name 'delb-*.whl') + just pytest other-quality-checks: runs-on: ubuntu-latest @@ -59,7 +75,7 @@ jobs: with: python-version: "3.12" - uses: extractions/setup-just@v2 - - run: pip install hatch + - run: pipx install hatch - run: just ${{ matrix.target }} ... diff --git a/Justfile b/Justfile index e1333c41..e48b1a1c 100644 --- a/Justfile +++ b/Justfile @@ -2,7 +2,7 @@ default: tests version := `hatch version` - +ci-suffix := if env_var("CI") == "true" { "-ci" } else { "" } # run benchmarks benchmarks: @@ -36,7 +36,7 @@ mypy: # run the complete testsuite pytest: - hatch run unit-tests:check + hatch run unit-tests{{ci-suffix}}:check # release the current version on github & the PyPI release: tests diff --git a/pyproject.toml b/pyproject.toml index b95890cc..1d8b0f4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -205,3 +205,10 @@ coverage-report = """ --cov=_delb --cov=delb \ tests """ + +[tool.hatch.envs.unit-tests-ci] +template = "unit-tests" +skip-install = true +extra-dependencies = [ + "delb @ {root:uri}/{env:WHEEL_PATH}" +]