Skip to content

Commit 1836df1

Browse files
committed
add separate testing workflow for PRs
1 parent 525dceb commit 1836df1

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/test.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Testing
2+
on: [pull_request]
3+
4+
jobs:
5+
6+
prepare:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
wheel-path: ${{ steps.distribution-paths.outputs.wheel }}
10+
tarball-path: ${{ steps.distribution-paths.outputs.tarball }}
11+
steps:
12+
- uses: actions/checkout@v3
13+
with: { fetch-depth: 0 } # deep clone for setuptools-scm
14+
- uses: actions/setup-python@v4
15+
with: { python-version: "3.11" }
16+
- name: Run static analysis and format checkers
17+
run: pipx run pre-commit run --all-files --show-diff-on-failure
18+
- name: Install tox-gh plugin
19+
run: python -m pip install tox-gh>=1.2
20+
- name: Build package distribution files
21+
run: tox -e clean,build
22+
- name: Record the paths of wheel and source tarball distributions
23+
id: distribution-paths
24+
run: |
25+
echo "wheel=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
26+
echo "tarball=$(ls dist/*.tar.gz)" >> $GITHUB_OUTPUT
27+
- name: Store the distribution files for use in other stages
28+
# `tests`, `pypi-publish`, and `docker-publish` will use the same
29+
# pre-built distributions, so we make sure to release the exact
30+
# same package that was tested
31+
uses: actions/upload-artifact@v3
32+
with:
33+
name: python-distribution-files
34+
path: dist/
35+
retention-days: 1
36+
- name: Keepalive Workflow
37+
uses: gautamkrishnar/keepalive-workflow@1.1.0
38+
with:
39+
time_elapsed: 44
40+
gh_token: ${{ secrets.GITHUB_TOKEN }}
41+
42+
test:
43+
needs: prepare
44+
strategy:
45+
matrix:
46+
python-version: ["3.10", "3.11", "3.12", "3.13"]
47+
platform:
48+
- ubuntu-latest
49+
- macos-latest
50+
# TODO: Debug the Windows issues
51+
# - windows-latest
52+
env:
53+
OS: ${{ matrix.platform }}
54+
PYTHON: ${{ matrix.python }}
55+
runs-on: ${{ matrix.platform }}
56+
steps:
57+
- uses: actions/checkout@v3
58+
- uses: actions/setup-python@v4
59+
with:
60+
python-version: ${{ matrix.python }}
61+
- uses: actions/download-artifact@v3
62+
with: { name: python-distribution-files, path: dist/ }
63+
- name: Install tox-gh plugin
64+
run: python -m pip install tox-gh>=1.2
65+
- name: Setup test suite
66+
run: tox -vv --notest
67+
- name: Run tests
68+
env:
69+
SYNAPSE_AUTH_TOKEN: ${{ secrets.SYNAPSE_AUTH_TOKEN }}
70+
run: >-
71+
tox --installpkg '${{ needs.prepare.outputs.wheel-path }}'
72+
-- -rFEx --durations 10 --color yes
73+
- name: Upload coverage to Codecov
74+
uses: codecov/codecov-action@v3
75+
with:
76+
# CodeCov can be flaky, so this step is not required for success
77+
fail_ci_if_error: false
78+
files: coverage.xml
79+
# Using matrix pattern from `codecov/codecov-action` README:
80+
# https://github.com/codecov/codecov-action#example-workflowyml-with-codecov-action
81+
env_vars: OS,PYTHON
82+
verbose: true

0 commit comments

Comments
 (0)