diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d2e42f..f0c86d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,18 +1,60 @@ --- -name: tox +name: test on: pull_request: jobs: + pre: + name: pre + runs-on: ubuntu-24.04 + outputs: + matrix: ${{ steps.generate_matrix.outputs.matrix }} + steps: + - name: Determine matrix + id: generate_matrix + uses: coactions/dynamic-matrix@v3 + with: + min_python: "3.12" + max_python: "3.12" + default_python: "3.12" + other_names: | + lint + docs test: - # tests reusable tox workflow - uses: ./.github/workflows/tox.yml - with: - default_python: "3.10" - jobs_producing_coverage: 0 - max_python: "3.13" - min_python: "3.10" - run_post: echo 'Running post' - run_pre: echo 'Running pre' + needs: pre + name: ${{ matrix.name || matrix.tox_env }} + runs-on: ${{ matrix.runs-on || 'ubuntu-latest' }} + strategy: + fail-fast: true + matrix: ${{ fromJson(needs.pre.outputs.matrix) }} + steps: + - name: Check out src from Git + uses: actions/checkout@v4 + with: + fetch-depth: 0 # needed by setuptools-scm + submodules: recursive + + - name: Install a default Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python_version }} + + - name: Install dependencies + run: | + python3 -m pip install 'tox>=4.0.0' + + - run: ${{ matrix.command }} + + - run: ${{ matrix.command2 }} + if: ${{ matrix.command2 }} + + - run: ${{ matrix.command3 }} + if: ${{ matrix.command3 }} + + - run: ${{ matrix.command4 }} + if: ${{ matrix.command4 }} + + - run: ${{ matrix.command5 }} + if: ${{ matrix.command5 }} check: # This job does nothing and is only used for the branch protection if: always() diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index fd14adb..d97b566 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -29,16 +29,6 @@ on: description: Additional names for the matrix required: false type: string - run_pre: - default: "" - description: Preparatory command to run before test commands. - required: false - type: string - run_post: - default: "" - description: Command to run after test commands. - required: false - type: string env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # might be needed by tox commands @@ -59,10 +49,11 @@ jobs: min_python: ${{ inputs.min_python }} max_python: ${{ inputs.max_python }} default_python: ${{ inputs.default_python }} - # we must use tox to query these other_names: | docs lint + pkg + py312-milestone ${{ inputs.other_names_also }} platforms: linux,macos @@ -95,16 +86,12 @@ jobs: key: pre-commit-${{ matrix.name }}-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set up Python ${{ matrix.python_version || '3.12' }} - if: ${{ !contains(matrix.shell, 'wsl') }} + if: "!contains(matrix.shell, 'wsl')" uses: actions/setup-python@v5 with: - cache: ${{ hashFiles('requirements.txt', 'pyproject.toml') && 'pip' || '' }} + cache: pip python-version: ${{ matrix.python_version || '3.12' }} - - name: Run pre - if: ${{ inputs.run_pre }} - run: ${{ inputs.run_pre }} - - name: Install tox run: | python3 -m pip install --upgrade pip @@ -127,10 +114,6 @@ jobs: - run: ${{ matrix.command5 }} if: ${{ matrix.command5 }} - - name: Run post - if: ${{ inputs.run_post }} - run: ${{ inputs.run_post }} - - name: Archive logs and coverage data uses: actions/upload-artifact@v4 with: @@ -193,7 +176,6 @@ jobs: fi - name: Upload coverage data - if: ${{ inputs.jobs_producing_coverage }} uses: codecov/codecov-action@v4 with: name: ${{ matrix.name }} @@ -201,7 +183,7 @@ jobs: use_oidc: true - name: Check codecov.io status - if: github.event_name == 'pull_request' && inputs.jobs_producing_coverage + if: github.event_name == 'pull_request' uses: coactions/codecov-status@main - name: Decide whether the needed jobs succeeded or failed