Refactor actions to use environment variables for versions #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: poetry-pytest | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: ["main"] | |
| env: | |
| POETRY_VERSION: "1.8.5" | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install poetry | |
| run: pipx install poetry==${{ env.POETRY_VERSION }} --python ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| poetry install --only main,test --all-extras | |
| - name: Test with pytest | |
| run: | | |
| poetry run pytest | |
| - name: Save Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-${{ matrix.python-version }}-${{ matrix.os }} | |
| path: coverage.xml | |
| overwrite: true | |
| retention-days: 1 | |
| coverage: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Restore all Coverage Reports | |
| uses: actions/download-artifact@v4 | |
| - name: Upload Coverage Report | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| slug: d-chris/click-validators | |
| token: ${{ secrets.CODECOV_TOKEN }} |