From 4e889f8fdb1bcd6cc2a4cb6a1716a460894f4c14 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Wed, 27 Mar 2024 09:05:12 +0100 Subject: [PATCH] Switch to tox & explicit list --- .github/workflows/ci-supported-pythons.yml | 39 +++++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-supported-pythons.yml b/.github/workflows/ci-supported-pythons.yml index 98c5fcd..f162c54 100644 --- a/.github/workflows/ci-supported-pythons.yml +++ b/.github/workflows/ci-supported-pythons.yml @@ -29,27 +29,48 @@ jobs: path: sampleproject outputs: - python-versions: ${{ steps.baipp.outputs.supported_pythons_json_job_matrix_value }} + python-versions: ${{ steps.baipp.outputs.supported_pythons_json_array }} + # If your matrix consists only of Python versions, you can use the + # following, too: + # python-versions: ${{ steps.baipp.outputs.supported_pythons_json_job_matrix_value }} test-package: needs: build-package runs-on: ubuntu-latest strategy: - matrix: ${{ fromJson(needs.build-package.outputs.python-versions) }} + matrix: + # Create matrix from the 'python-versions' output from the build-package + # job. + python-version: ${{ fromJson(python-versions) }} + + # If you set 'python-versions' to + # 'supported_pythons_json_job_matrix_value' + # above, you would set the matrix like this instead: + # matrix: ${{ fromJson(needs.build-package.outputs.python-versions) }} + steps: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - run: pip install pytest - - uses: actions/download-artifact@v4 + + - name: Download built packages from the build-package job. + uses: actions/download-artifact@v4 with: name: Packages path: dist - - run: pip install dist/*.whl - - uses: actions/checkout@v4 - with: - repository: pypa/sampleproject - - run: python -Im pytest tests/ + + - name: Prepare tests & config + run: | + # We use tox together with the fast tox-uv plugin. + python -mI pip install tox-uv + + # Unpack SDist for tests & config files. + tar xf dist/*.tar.gz --strip-components=1 + + # Ensure tests run against wheel. + rm -rf src + + - run: python -Im tox run --installpkg dist/*.whl -f py$(echo ${{ matrix.python-version }} | tr -d .) ...