From c2b975fe20216c71309a77c87e26e1bd7f4b4920 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 21 Dec 2022 09:13:16 +0000 Subject: [PATCH] Adopt dynamic-matrix --- .github/workflows/tox.yml | 62 ++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 0ba7ab8..16b969c 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -10,58 +10,52 @@ on: - main jobs: + pre: + name: pre + runs-on: ubuntu-22.04 + outputs: + matrix: ${{ steps.generate_matrix.outputs.matrix }} + steps: + - name: Determine matrix + id: generate_matrix + uses: coactions/matrix@main + with: + other_names: | + lint + packaging + docs build: name: ${{ matrix.name }} - runs-on: ${{ matrix.os || 'ubuntu-latest' }} + needs: pre + runs-on: ${{ matrix.os || 'ubuntu-22.04' }} strategy: fail-fast: false - matrix: - include: - - name: docs - python: "3.10" - tox_env: docs - - name: "lint" - python: "3.10" - tox_env: "lint" - - name: "packaging" - python: "3.10" - tox_env: "packaging" - - - name: py37 - python: "3.7" - tox_env: py37 - - name: py38 - python: "3.8" - tox_env: py38 - - name: py39 - python: "3.9" - tox_env: py39 - - name: py310 - python: "3.10" - tox_env: py310 - - name: py311 - python: "~3.11.0-0" # see https://github.com/actions/setup-python/issues/213#issuecomment-1146676713 - tox_env: py311 + matrix: ${{ fromJson(needs.pre.outputs.matrix) }} steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python }} + with: + fetch-depth: 0 # needed by setuptools-scm + + - name: Set up Python ${{ matrix.python_version }} uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python }} + python-version: ${{ matrix.python_version }} + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox - - name: Test - run: "tox -e ${{ matrix.tox_env }}" + pip install tox>=4.0 + + - name: tox run -e ${{ matrix.passed_name }} + run: tox run -e ${{ matrix.passed_name }} check: # This job does nothing and is only used for the branch protection if: always() needs: - build - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1