Skip to content

Commit cbc0157

Browse files
authored
Merge pull request #116 from cisagov/improvement/test_wheels_built_in_github_actions
Add a GitHub Actions job to test built wheels
2 parents 5314334 + 63f4a73 commit cbc0157

File tree

1 file changed

+59
-2
lines changed

1 file changed

+59
-2
lines changed

.github/workflows/build.yml

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ jobs:
159159
if: env.RUN_TMATE
160160
coveralls-finish:
161161
runs-on: ubuntu-latest
162-
needs: test
162+
needs:
163+
- test
163164
steps:
164165
- uses: actions/checkout@v3
165166
- id: setup-python
@@ -194,6 +195,9 @@ jobs:
194195
if: env.RUN_TMATE
195196
build:
196197
runs-on: ${{ matrix.os }}
198+
needs:
199+
- lint
200+
- test
197201
strategy:
198202
fail-fast: false
199203
matrix:
@@ -207,7 +211,6 @@ jobs:
207211
include:
208212
- os: ubuntu-20.04
209213
python-version: "3.6"
210-
needs: [lint, test]
211214
steps:
212215
- uses: actions/checkout@v3
213216
- id: setup-python
@@ -242,3 +245,57 @@ jobs:
242245
- name: Setup tmate debug session
243246
uses: mxschmitt/action-tmate@v3
244247
if: env.RUN_TMATE
248+
test-build:
249+
runs-on: ${{ matrix.os }}
250+
needs:
251+
- build
252+
strategy:
253+
fail-fast: false
254+
matrix:
255+
os:
256+
- ubuntu-latest
257+
python-version:
258+
- "3.7"
259+
- "3.8"
260+
- "3.9"
261+
- "3.10"
262+
include:
263+
- os: ubuntu-20.04
264+
python-version: "3.6"
265+
steps:
266+
- uses: actions/checkout@v3
267+
- id: setup-python
268+
uses: actions/setup-python@v4
269+
with:
270+
python-version: ${{ matrix.python-version }}
271+
- uses: actions/cache@v3
272+
env:
273+
BASE_CACHE_KEY: "${{ github.job }}-${{ runner.os }}-\
274+
py${{ steps.setup-python.outputs.python-version }}-"
275+
with:
276+
path: ${{ env.PIP_CACHE_DIR }}
277+
# We do not use '**/setup.py' in the cache key so only the 'setup.py'
278+
# file in the root of the repository is used. This is in case a Python
279+
# package were to have a 'setup.py' as part of its internal codebase.
280+
key: "${{ env.BASE_CACHE_KEY }}\
281+
${{ hashFiles('**/requirements.txt') }}-\
282+
${{ hashFiles('setup.py') }}"
283+
restore-keys: |
284+
${{ env.BASE_CACHE_KEY }}
285+
- name: Retrieve the built wheel
286+
uses: actions/download-artifact@v3
287+
with:
288+
name: dist-${{ matrix.python-version }}
289+
- name: Install testing dependencies
290+
run: |
291+
python -m pip install --upgrade pip setuptools wheel
292+
python -m pip install --upgrade pytest pytest-cov
293+
- name: Install the built wheel (there should only be one)
294+
run: python -m pip install *.whl
295+
- name: Run tests
296+
env:
297+
RELEASE_TAG: ${{ github.event.release.tag_name }}
298+
run: pytest
299+
- name: Setup tmate debug session
300+
uses: mxschmitt/action-tmate@v3
301+
if: env.RUN_TMATE

0 commit comments

Comments
 (0)