From 122afedddfb28be1e5ed56679db572e06386299a Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Sun, 24 Mar 2024 18:34:41 -0600 Subject: [PATCH] ci/tests: break individual test steps out into jobs --- .github/workflows/tests.yaml | 96 +++++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4a4c2a5f39a..40fc1285301 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -81,12 +81,43 @@ jobs: - name: Check for changed files run: git diff --exit-code --stat HEAD tests/repositories/fixtures/pypi.org + mypy: + name: mypy (${{ matrix.os.name }} / Python ${{ matrix.python-version }}) + runs-on: ${{ matrix.os.image }} + if: needs.changes.outputs.tests-mypy == 'true' + needs: + - changes + - lockfile + strategy: + matrix: + os: + - name: Ubuntu + image: ubuntu-22.04 + - name: macOS + image: macos-12 + - name: Windows + image: windows-2022 + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + fail-fast: false + steps: + - uses: actions/checkout@v4 + + - uses: ./.github/actions/bootstrap-poetry + with: + python-version: ${{ matrix.python-version }} + + - run: poetry install --sync + + - run: poetry run mypy + pytest: - name: ${{ matrix.os.name }} / ${{ matrix.python-version }} + name: pytest (${{ matrix.os.name }} / Python ${{ matrix.python-version }}) runs-on: ${{ matrix.os.image }} + if: needs.changes.outputs.tests-pytest == 'true' needs: - changes - lockfile + - mypy strategy: matrix: os: @@ -100,48 +131,57 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v4 - if: needs.changes.outputs.tests-pytest == 'true' - uses: ./.github/actions/bootstrap-poetry - if: needs.changes.outputs.tests-pytest == 'true' with: python-version: ${{ matrix.python-version }} - run: poetry install --sync --with github-actions - if: needs.changes.outputs.tests-pytest == 'true' - - - name: Run mypy - if: needs.changes.outputs.tests-pytest == 'true' - run: poetry run mypy - - name: Run pytest - if: needs.changes.outputs.tests-pytest == 'true' + - run: poetry run pytest --integration -v env: POETRY_TEST_INTEGRATION_GIT_USERNAME: ${{ github.actor }} POETRY_TEST_INTEGRATION_GIT_PASSWORD: ${{ github.token }} - run: poetry run pytest --integration -v - - name: Get Plugin Version (poetry-plugin-export) - id: poetry-plugin-export-version - if: needs.changes.outputs.tests-pytest == 'true' - run: | - echo version=$(poetry show poetry-plugin-export | grep version | cut -d : -f 2 | xargs) >> $GITHUB_OUTPUT + - run: git diff --exit-code --stat HEAD - - name: Checkout Plugin Source (poetry-plugin-export) - uses: actions/checkout@v4 - if: needs.changes.outputs.tests-pytest == 'true' + pytest-export: + name: pytest (${{ matrix.os.name }} / Python ${{ matrix.python-version }}) + runs-on: ${{ matrix.os.image }} + needs: + - changes + - lockfile + - mypy + strategy: + matrix: + os: + - name: Ubuntu + image: ubuntu-22.04 + - name: macOS + image: macos-12 + - name: Windows + image: windows-2022 + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + fail-fast: false + steps: + - uses: actions/checkout@v4 + + - uses: ./.github/actions/bootstrap-poetry + with: + python-version: ${{ matrix.python-version }} + + - run: poetry install --sync --with github-actions + + - id: poetry-plugin-export + run: echo version=$(pip list --format json | jq -r '.[] | select(.name == "poetry-plugin-export").version') >> $GITHUB_OUTPUT + + - uses: actions/checkout@v4 with: path: poetry-plugin-export repository: python-poetry/poetry-plugin-export - ref: refs/tags/${{ steps.poetry-plugin-export-version.outputs.version }} + ref: refs/tags/${{ steps.poetry-plugin-export.outputs.version }} - - name: Run pytest (poetry-plugin-export) - if: needs.changes.outputs.tests-pytest == 'true' + - run: poetry run -C .. pytest -v working-directory: ./poetry-plugin-export - run: poetry run -C .. pytest -v - - name: Check for clean working tree - if: needs.changes.outputs.tests-pytest == 'true' - run: | - git diff --exit-code --stat HEAD - git -C poetry-plugin-export diff --exit-code --stat HEAD + - run: git -C poetry-plugin-export diff --exit-code --stat HEAD