|
1 | 1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
2 | 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
3 | | - |
4 | 3 | name: poetry-pytest |
5 | | - |
6 | 4 | on: |
7 | 5 | workflow_dispatch: |
8 | | - |
9 | 6 | pull_request: |
10 | | - branches: [ "main" ] |
11 | | - |
| 7 | + branches: ["main"] |
12 | 8 | jobs: |
13 | 9 | test: |
14 | | - |
15 | 10 | runs-on: ${{ matrix.os }} |
16 | 11 | strategy: |
17 | 12 | fail-fast: false |
18 | 13 | matrix: |
19 | 14 | os: [ubuntu-latest, windows-latest] |
20 | 15 | python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
21 | | - |
22 | 16 | steps: |
23 | | - - uses: actions/checkout@v4 |
24 | | - - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} |
25 | | - uses: actions/setup-python@v5 |
26 | | - with: |
27 | | - python-version: ${{ matrix.python-version }} |
28 | | - - name: Install dependencies |
29 | | - run: | |
30 | | - python -m pip install --upgrade pip |
31 | | - pip install poetry |
32 | | - poetry install --without doc |
33 | | - - name: Test with pytest |
34 | | - run: | |
35 | | - poetry run pytest |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + - name: Install poetry |
| 19 | + run: pipx install poetry |
| 20 | + - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} |
| 21 | + uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: ${{ matrix.python-version }} |
| 24 | + cache: 'poetry' |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + poetry install --only main,test |
| 28 | + - name: Test with pytest |
| 29 | + run: | |
| 30 | + poetry run pytest |
| 31 | + - name: Save Coverage Report |
| 32 | + uses: actions/upload-artifact@v4 |
| 33 | + with: |
| 34 | + name: coverage-${{ matrix.python-version }}-${{ matrix.os }} |
| 35 | + path: coverage.xml |
| 36 | + overwrite: true |
| 37 | + retention-days: 1 |
| 38 | + coverage: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + needs: test |
| 41 | + steps: |
| 42 | + - name: Restore all Coverage Reports |
| 43 | + uses: actions/download-artifact@v4 |
| 44 | + - name: Upload Coverage Report |
| 45 | + uses: codecov/codecov-action@v4 |
| 46 | + with: |
| 47 | + flags: unittests |
| 48 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments