Skip to content

Commit e1782f0

Browse files
committed
ci(pytest): Be OS-explicit in the pytest regression tests
This makes it easier to add support for MS-Windows and macOS Only upload to coveralls from the main repo, not from the forks
1 parent e72707f commit e1782f0

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

.github/workflows/pytest.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ jobs:
2929
strategy:
3030
fail-fast: false
3131
matrix:
32-
# os: [ubuntu-latest, macos-latest, windows-latest]
33-
# python-version: ["3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"]
3432
os: [ubuntu-latest]
35-
python-version: ["3.9", "3.14", "3.14t"]
33+
python-version: ["3.14"] # to make sure the latest AMC supported python version does not break
34+
include:
35+
- os: ubuntu-latest
36+
python-version: "3.9" # to make sure the minimum AMC supported python version does not break
37+
# this is also the version used to report test coverage, other versions do not report coverage
3638

3739
steps:
3840
- name: Harden the runner (Audit all outbound calls)
41+
if: matrix.os != 'windows-latest'
3942
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
4043
with:
4144
egress-policy: audit
@@ -50,7 +53,8 @@ jobs:
5053
python-version: ${{ matrix.python-version }}
5154
activate-environment: true
5255

53-
- name: Install system dependencies for GUI testing
56+
- name: Install system dependencies for GUI testing on linux
57+
if: matrix.os == 'ubuntu-latest'
5458
run: |
5559
sudo apt-get update
5660
# Only install system Tcl/Tk for Python < 3.13 (newer versions bundle their own)
@@ -65,6 +69,7 @@ jobs:
6569
python3 --version && python3 -c "import tkinter; print(tkinter.TclVersion, tkinter.TkVersion)"
6670
6771
- name: Ensure Tcl/Tk search paths
72+
if: matrix.os == 'ubuntu-latest'
6873
run: |
6974
# Only set Tcl/Tk paths for Python < 3.13
7075
if [[ "${{ matrix.python-version }}" < "3.13" ]]; then
@@ -81,6 +86,7 @@ jobs:
8186
uv pip install --editable .[dev,ci_headless_tests]
8287
8388
- name: Download ArduCopter SITL (if available)
89+
if: matrix.os == 'ubuntu-latest'
8490
run: |
8591
# Create cache key based on current quarter (YYYY-Q)
8692
CURRENT_YEAR=$(date +%Y)
@@ -160,31 +166,38 @@ jobs:
160166
if: ${{ always() }}
161167

162168
- name: Upload coverage xml report
169+
# Use always() to always run this step to publish test results when there are test failures
170+
if: matrix.os == 'ubuntu-latest' && always()
163171
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
164172
with:
165173
name: coverage-${{ matrix.python-version }}-xml
166174
path: tests/*.xml
167175
retention-days: 1
168-
# Use always() to always run this step to publish test results when there are test failures
169-
if: ${{ always() }}
170176

171177
- name: Upload coverage report
178+
# Use always() to always run this step to publish test results when there are test failures
179+
if: matrix.os == 'ubuntu-latest' && always()
172180
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
173181
with:
174182
name: coverage-${{ matrix.python-version }}
175183
path: .coverage
176184
include-hidden-files: true
177185
retention-days: 1
178-
# Use always() to always run this step to publish test results when there are test failures
179-
if: ${{ always() }}
180186

181187
upload_coverage_to_coveralls:
182-
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') && (success() || failure())
188+
if: >
189+
github.repository == 'ArduPilot/MethodicConfigurator' &&
190+
matrix.os == 'ubuntu-latest' &&
191+
matrix.python-version == '3.9' &&
192+
github.event_name == 'push' &&
193+
github.ref == 'refs/heads/master' &&
194+
(success() || failure())
183195
runs-on: ubuntu-latest
184196
needs: pytest
185197

186198
steps:
187199
- name: Harden the runner (Audit all outbound calls)
200+
if: matrix.os != 'windows-latest'
188201
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
189202
with:
190203
egress-policy: audit
@@ -212,6 +225,7 @@ jobs:
212225

213226
steps:
214227
- name: Harden the runner (Audit all outbound calls)
228+
if: matrix.os != 'windows-latest'
215229
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
216230
with:
217231
egress-policy: audit
@@ -257,6 +271,7 @@ jobs:
257271

258272
steps:
259273
- name: Harden the runner (Audit all outbound calls)
274+
if: matrix.os != 'windows-latest'
260275
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
261276
with:
262277
egress-policy: audit
@@ -316,6 +331,7 @@ jobs:
316331

317332
steps:
318333
- name: Harden the runner (Audit all outbound calls)
334+
if: matrix.os != 'windows-latest'
319335
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
320336
with:
321337
egress-policy: audit

0 commit comments

Comments
 (0)