Skip to content

Commit f8f97c6

Browse files
committed
ci(main,pr): add automated testing on windows in parallel with linux
1 parent 0e8451c commit f8f97c6

2 files changed

Lines changed: 64 additions & 12 deletions

File tree

.github/workflows/main.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ on:
1010

1111
jobs:
1212
test:
13-
name: Python ${{ matrix.python-version }} tests
14-
runs-on: ubuntu-latest
13+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} tests
14+
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
1717
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
18+
os: [ubuntu-latest, windows-latest]
1819

1920
steps:
2021
- uses: actions/checkout@v4
@@ -39,8 +40,9 @@ jobs:
3940
python -m pip install .[test]
4041
python -m pip install pytest-github-actions-annotate-failures
4142
42-
- name: pytest
43-
id: tests
43+
- name: pytest on Linux
44+
id: tests-linux
45+
if: ${{ matrix.os == 'ubuntu-latest' }}
4446
run: |
4547
python -m pytest \
4648
-vv \
@@ -51,9 +53,33 @@ jobs:
5153
--cov-fail-under=80 \
5254
--junit-xml=tests/reports/pytest-results.xml
5355
54-
- name: Report | Upload Test Results
56+
- name: pytest on windows
57+
id: tests-win
58+
if: ${{ matrix.os == 'windows-latest' }}
59+
# env:
60+
# Required for GitPython to work on Windows because of getpass.getuser()
61+
# USERNAME: "runneradmin"
62+
# Because GHA is currently broken on Windows to pass these varables, we do it manually
63+
run: |
64+
$env:USERNAME = "runneradmin"
65+
python -m pytest `
66+
-vv `
67+
-nauto `
68+
`--cov=semantic_release `
69+
`--cov-context=test `
70+
`--cov-report=term-missing `
71+
`--cov-fail-under=80 `
72+
`--junit-xml=tests/reports/pytest-results.xml
73+
74+
- name: Report | Upload Linux Test Results
75+
uses: mikepenz/action-junit-report@v4.3.1
76+
if: ${{ always() && steps.tests-linux.outcome != 'skipped' }}
77+
with:
78+
report_paths: ./tests/reports/*.xml
79+
80+
- name: Report | Upload Windows Test Results
5581
uses: mikepenz/action-junit-report@v4.3.1
56-
if: ${{ always() && steps.tests.outcome != 'skipped' }}
82+
if: ${{ always() && steps.tests-win.outcome != 'skipped' }}
5783
with:
5884
report_paths: ./tests/reports/*.xml
5985

.github/workflows/pr.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ on:
66

77
jobs:
88
test:
9-
name: Python ${{ matrix.python-version }} tests
10-
runs-on: ubuntu-latest
9+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} tests
10+
runs-on: ${{ matrix.os }}
1111
strategy:
1212
matrix:
1313
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
14+
os: [ubuntu-latest, windows-latest]
1415

1516
steps:
1617
- uses: actions/checkout@v4
@@ -36,8 +37,9 @@ jobs:
3637
python -m pip install .[test]
3738
python -m pip install pytest-github-actions-annotate-failures
3839
39-
- name: pytest
40-
id: tests
40+
- name: pytest on Linux
41+
id: tests-linux
42+
if: ${{ matrix.os == 'ubuntu-latest' }}
4143
run: |
4244
python -m pytest \
4345
-vv \
@@ -48,9 +50,33 @@ jobs:
4850
--cov-fail-under=80 \
4951
--junit-xml=tests/reports/pytest-results.xml
5052
51-
- name: Report | Upload Test Results
53+
- name: pytest on windows
54+
id: tests-win
55+
if: ${{ matrix.os == 'windows-latest' }}
56+
# env:
57+
# Required for GitPython to work on Windows because of getpass.getuser()
58+
# USERNAME: "runneradmin"
59+
# Because GHA is currently broken on Windows to pass these varables, we do it manually
60+
run: |
61+
$env:USERNAME = "runneradmin"
62+
python -m pytest `
63+
-vv `
64+
-nauto `
65+
`--cov=semantic_release `
66+
`--cov-context=test `
67+
`--cov-report=term-missing `
68+
`--cov-fail-under=80 `
69+
`--junit-xml=tests/reports/pytest-results.xml
70+
71+
- name: Report | Upload Linux Test Results
72+
uses: mikepenz/action-junit-report@v4.3.1
73+
if: ${{ always() && steps.tests-linux.outcome != 'skipped' }}
74+
with:
75+
report_paths: ./tests/reports/*.xml
76+
77+
- name: Report | Upload Windows Test Results
5278
uses: mikepenz/action-junit-report@v4.3.1
53-
if: ${{ always() && steps.tests.outcome != 'skipped' }}
79+
if: ${{ always() && steps.tests-win.outcome != 'skipped' }}
5480
with:
5581
report_paths: ./tests/reports/*.xml
5682

0 commit comments

Comments
 (0)