Skip to content

Commit

Permalink
ci/tests: break individual test steps out into jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
neersighted committed Mar 25, 2024
1 parent 125c15e commit 122afed
Showing 1 changed file with 68 additions and 28 deletions.
96 changes: 68 additions & 28 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 122afed

Please sign in to comment.