|
1 | 1 | name: Main testing workflow |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
5 | 4 | pull_request: |
6 | 5 | workflow_dispatch: |
7 | | - |
8 | 6 | jobs: |
9 | 7 | build: |
10 | 8 | name: Build package |
|
17 | 15 | cache: "pip" |
18 | 16 | - name: Install pypa/build |
19 | 17 | run: >- |
20 | | - python3 -m pip install --user |
21 | | - build |
22 | | - twine |
| 18 | + python3 -m pip install --user build twine |
23 | 19 | - name: Build a binary wheel and a source tarball |
24 | 20 | run: python3 -m build |
25 | 21 | - name: Check the distribution files with `twine` |
@@ -58,76 +54,65 @@ jobs: |
58 | 54 | toxfactor: py3.13 |
59 | 55 | ignore-typecheck-outcome: true |
60 | 56 | ignore-test-outcome: false |
61 | | - |
62 | 57 | steps: |
63 | | - - uses: actions/checkout@v4 |
64 | | - |
65 | | - - name: Set up Python ${{ matrix.python-version }} |
66 | | - uses: actions/setup-python@v4 |
67 | | - id: setup-python |
68 | | - with: |
69 | | - python-version: ${{ matrix.python-version }} |
70 | | - |
71 | | - - name: Install poetry |
72 | | - run: | |
73 | | - python -m pip install poetry==2.0.0 |
74 | | -
|
75 | | - - name: Configure poetry |
76 | | - run: | |
77 | | - python -m poetry config virtualenvs.in-project true |
78 | | -
|
79 | | - - name: Cache the virtualenv |
80 | | - id: poetry-dependencies-cache |
81 | | - uses: actions/cache@v3 |
82 | | - with: |
83 | | - path: ./.venv |
84 | | - key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
85 | | - |
86 | | - - name: Install dev dependencies |
87 | | - if: steps.poetry-dependencies-cache.outputs.cache-hit != 'true' |
88 | | - run: | |
89 | | - python -m poetry install --only=dev |
90 | | -
|
91 | | - - name: Download artifact |
92 | | - uses: actions/download-artifact@v4 |
93 | | - with: |
94 | | - name: dist-files |
95 | | - path: dist/ |
96 | | - |
97 | | - - name: Type checking |
98 | | - # Ignore errors for older pythons |
99 | | - continue-on-error: ${{ matrix.ignore-typecheck-outcome }} |
100 | | - run: | |
101 | | - source .venv/bin/activate |
102 | | - tox -e mypy |
103 | | -
|
104 | | - - name: Test with tox |
105 | | - continue-on-error: ${{ matrix.ignore-test-outcome }} |
106 | | - run: | |
107 | | - source .venv/bin/activate |
108 | | - coverage erase |
109 | | - # Using `--parallel 4` as it's the number of CPUs in the GitHub Actions runner |
110 | | - # Using `installpkg dist/*.whl` because we want to install the pre-built package (want to test against that) |
111 | | - tox run-parallel -f ${{ matrix.toxfactor }} --parallel 4 --parallel-no-spinner --parallel-live --installpkg dist/*.whl |
112 | | - coverage combine |
113 | | - coverage xml |
114 | | -
|
115 | | - - uses: codecov/codecov-action@v4 |
116 | | - with: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + - name: Set up Python ${{ matrix.python-version }} |
| 60 | + uses: actions/setup-python@v4 |
| 61 | + id: setup-python |
| 62 | + with: |
| 63 | + python-version: ${{ matrix.python-version }} |
| 64 | + - name: Install poetry |
| 65 | + run: | |
| 66 | + python -m pip install poetry==2.0.0 |
| 67 | + - name: Configure poetry |
| 68 | + run: | |
| 69 | + python -m poetry config virtualenvs.in-project true |
| 70 | + - name: Cache the virtualenv |
| 71 | + id: poetry-dependencies-cache |
| 72 | + uses: actions/cache@v3 |
| 73 | + with: |
| 74 | + path: ./.venv |
| 75 | + key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 76 | + - name: Install dev dependencies |
| 77 | + if: steps.poetry-dependencies-cache.outputs.cache-hit != 'true' |
| 78 | + run: | |
| 79 | + python -m poetry install --only=dev |
| 80 | + - name: Download artifact |
| 81 | + uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + name: dist-files |
| 84 | + path: dist/ |
| 85 | + - name: Type checking |
| 86 | + # Ignore errors for older pythons |
| 87 | + continue-on-error: ${{ matrix.ignore-typecheck-outcome }} |
| 88 | + run: | |
| 89 | + source .venv/bin/activate |
| 90 | + tox -e mypy |
| 91 | + - name: Test with tox |
| 92 | + continue-on-error: ${{ matrix.ignore-test-outcome }} |
| 93 | + run: | |
| 94 | + source .venv/bin/activate |
| 95 | + coverage erase |
| 96 | + # Using `--parallel 4` as it's the number of CPUs in the GitHub Actions runner |
| 97 | + # Using `installpkg dist/*.whl` because we want to install the pre-built package (want to test against that) |
| 98 | + tox run-parallel -f ${{ matrix.toxfactor }} --parallel 4 --parallel-no-spinner --parallel-live --installpkg dist/*.whl |
| 99 | + coverage combine |
| 100 | + coverage xml |
| 101 | + - uses: codecov/codecov-action@v4 |
| 102 | + with: |
117 | 103 | # Explicitly using the token to avoid Codecov rate limit errors |
118 | | - # See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 |
119 | | - token: ${{ secrets.CODECOV_TOKEN }} |
120 | | - fail_ci_if_error: false |
121 | | - verbose: true # optional (default = false) |
122 | | - |
| 104 | + # See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 |
| 105 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 106 | + fail_ci_if_error: false |
| 107 | + verbose: true # optional (default = false) |
123 | 108 | pypi-publish: |
124 | 109 | name: Upload release to PyPI |
125 | 110 | runs-on: ubuntu-latest |
126 | 111 | environment: |
127 | 112 | name: pypi |
128 | 113 | url: https://pypi.org/p/pytest-factoryboy |
129 | 114 | permissions: |
130 | | - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing |
| 115 | + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing |
131 | 116 | if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
132 | 117 | needs: |
133 | 118 | - "test-run" |
|
0 commit comments