Skip to content

Commit 034cef8

Browse files
committed
Add a GitHub Actions job to test wheels
This job will test thw wheels created during the `build` job to ensure the distribution artifact also passes tests.
1 parent 5314334 commit 034cef8

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,56 @@ jobs:
242242
- name: Setup tmate debug session
243243
uses: mxschmitt/action-tmate@v3
244244
if: env.RUN_TMATE
245+
test-build:
246+
runs-on: ${{ matrix.os }}
247+
strategy:
248+
fail-fast: false
249+
matrix:
250+
os:
251+
- ubuntu-latest
252+
python-version:
253+
- "3.7"
254+
- "3.8"
255+
- "3.9"
256+
- "3.10"
257+
include:
258+
- os: ubuntu-20.04
259+
python-version: "3.6"
260+
needs: [build]
261+
steps:
262+
- uses: actions/checkout@v3
263+
- id: setup-python
264+
uses: actions/setup-python@v4
265+
with:
266+
python-version: ${{ matrix.python-version }}
267+
- uses: actions/cache@v3
268+
env:
269+
BASE_CACHE_KEY: "${{ github.job }}-${{ runner.os }}-\
270+
py${{ steps.setup-python.outputs.python-version }}-"
271+
with:
272+
path: ${{ env.PIP_CACHE_DIR }}
273+
# We do not use '**/setup.py' in the cache key so only the 'setup.py'
274+
# file in the root of the repository is used. This is in case a Python
275+
# package were to have a 'setup.py' as part of its internal codebase.
276+
key: "${{ env.BASE_CACHE_KEY }}\
277+
${{ hashFiles('**/requirements.txt') }}-\
278+
${{ hashFiles('setup.py') }}"
279+
restore-keys: |
280+
${{ env.BASE_CACHE_KEY }}
281+
- name: Retrieve the built wheel
282+
uses: actions/download-artifact@v3
283+
with:
284+
name: dist-${{ matrix.python-version }}
285+
- name: Install testing dependencies
286+
run: |
287+
python -m pip install --upgrade pip setuptools wheel
288+
python -m pip install --upgrade pytest pytest-cov
289+
- name: Install the built wheel (there should only be one)
290+
run: python -m pip install *.whl
291+
- name: Run tests
292+
env:
293+
RELEASE_TAG: ${{ github.event.release.tag_name }}
294+
run: pytest
295+
- name: Setup tmate debug session
296+
uses: mxschmitt/action-tmate@v3
297+
if: env.RUN_TMATE

0 commit comments

Comments
 (0)