@@ -2,6 +2,10 @@ name: Python Tests
22
33on :
44 workflow_dispatch :
5+ push :
6+ branches :
7+ - main
8+ - release-*
59 pull_request :
610 merge_group :
711
1620 outputs :
1721 should_run : ${{ steps.filter.outputs.python }}
1822 renode_driver : ${{ steps.filter.outputs.renode_driver }}
19- python-versions : ${{ steps.matrix.outputs.python-versions }}
20- runners : ${{ steps.matrix.outputs.runners }}
2123 steps :
22- - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
24+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
2325 with :
2426 fetch-depth : 0
2527 - uses : dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
@@ -34,41 +36,23 @@ jobs:
3436 - '.github/workflows/python-tests.yaml'
3537 renode_driver:
3638 - 'python/packages/jumpstarter-driver-renode/**'
37- - name : Compute test matrix
38- id : matrix
39- run : |
40- # PRs: test only Python 3.12 on Linux to save CI time.
41- # Merge queue and workflow_dispatch run the full matrix
42- # (all Python versions on both Linux and macOS).
43- if [[ "${{ github.event_name }}" == "pull_request" ]]; then
44- echo 'python-versions=["3.11", "3.12", "3.13"]' >> "$GITHUB_OUTPUT"
45- echo 'runners=["macos-15"]' >> "$GITHUB_OUTPUT"
46- else
47- echo 'python-versions=["3.11", "3.12", "3.13"]' >> "$GITHUB_OUTPUT"
48- echo 'runners=["ubuntu-24.04", "macos-15"]' >> "$GITHUB_OUTPUT"
49- fi
5039
5140 pytest-matrix :
5241 needs : changes
5342 if : needs.changes.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch'
5443 runs-on : ${{ matrix.runs-on }}
5544 strategy :
56- fail-fast : false
5745 matrix :
58- runs-on : ${{ fromJson(needs.changes.outputs.runners) }}
59- python-version : ${{ fromJson(needs.changes.outputs.python-versions) }}
60- run-index : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
46+ runs-on : [ubuntu-24.04, macos-15]
47+ # Floor: oldest Python in supported platforms (RHEL 9 appstream)
48+ # Ceiling: newest Python in latest Fedora
49+ # Review on each RHEL/Fedora release
50+ python-version : ["3.11", "3.12", "3.13"]
6151 steps :
62- - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
52+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
6353 with :
6454 fetch-depth : 0
6555
66- - name : Free up runner disk space
67- uses : mathio/gha-cleanup@aca3d43a05bf564f5fc69acb929a65b01797f22b # v1.1.2
68- with :
69- remove-browsers : true
70- verbose : true
71-
7256 - id : uv
7357 run : echo "version=$(cat .uv-version)" >> "$GITHUB_OUTPUT"
7458 - name : Install uv
9377 sudo chmod 0666 /dev/kvm /dev/vhost-vsock /dev/vhost-net
9478
9579 sudo apt-get update
96- sudo apt-get install -y qemu-system-arm qemu-system-x86 rpm2cpio cpio
80+ sudo apt-get install -y qemu-system-arm qemu-system-x86
9781
9882 - name : Install libgpiod-dev (Linux)
9983 if : runner.os == 'Linux'
@@ -154,18 +138,9 @@ jobs:
154138 - name : Run pytest
155139 working-directory : python
156140 env :
157- PYTEST_ADDOPTS : " --cov-report=xml --log-level=CRITICAL --log-cli-level=CRITICAL "
141+ PYTEST_ADDOPTS : " --cov-report=xml"
158142 run : |
159- make test -j4 LOGS_DIR=${{ runner.temp }}/test-logs
160-
161- - name : Upload test logs
162- if : always()
163- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
164- with :
165- name : test-logs-${{ matrix.runs-on }}-py${{ matrix.python-version }}
166- path : ${{ runner.temp }}/test-logs/
167- if-no-files-found : ignore
168- retention-days : 7
143+ make test
169144
170145 # Diff-coverage is only checked on Linux. Several packages (e.g.
171146 # jumpstarter-driver-dut-network) are Linux-only, so their tests are
@@ -181,7 +156,7 @@ jobs:
181156 echo "::error::No coverage.xml files found"
182157 exit 1
183158 fi
184- uv run diff-cover $coverage_files --compare-branch=origin/${{ github.base_ref }} --fail-under=80 --exclude '*_pb2.py' '*_pb2_grpc.py' '**/conftest.py' '**/test_*.py' '**/*_test.py'
159+ uv run diff-cover $coverage_files --compare-branch=origin/${{ github.base_ref }} --fail-under=80 --exclude '*_pb2.py' '*_pb2_grpc.py' '**/conftest.py'
185160
186161 # https://github.com/orgs/community/discussions/26822
187162 pytest :
0 commit comments