Skip to content

Commit dc4f59e

Browse files
GH Actions: Fix OS issue, separate legacy tests
This patch makes several changes to the GH action CI: * Python and OS version testing actually works now. - The incorrect `python` was renamed to `python-version` (Thanks to Clément Robert, @neutrinoceros) - `runs-on` now correctly pulls from the matrix, rather than set to `ubuntu-latest`. In fact, references to fixed Ubuntu versions are gone entirely. * The unsupported Python versions (2.7,3.5-7) are moved to "legacy" container-based tests, since no sane version of * `pull_request` trigger added (again, thanks @neutrinoceros) * `setup-python` upgraded to @v5 All tests appear to be running correctly now. Co-authored-by: Clément Robert <[email protected]>
1 parent 73f4d72 commit dc4f59e

File tree

1 file changed

+63
-35
lines changed

1 file changed

+63
-35
lines changed

.github/workflows/testing.yaml

Lines changed: 63 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,52 @@
11
name: f90nml
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
6-
build:
6+
legacy:
7+
strategy:
8+
matrix:
9+
python: ["2.7", "3.5", "3.6", "3.7"]
710
runs-on: ubuntu-latest
11+
container:
12+
image: python:${{ matrix.python }}
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v3
16+
17+
- name: Install dependencies
18+
run: |
19+
python --version
20+
pip --version
21+
pip install --upgrade pip
22+
pip install -r tests/requirements_test.txt
23+
pip install pytest pytest-cov
24+
25+
- name: Run tests
26+
run: pytest --cov --cov-branch --cov-report=xml
27+
28+
- name: Upload coverage to Codecov (bash uploader fallback)
29+
if: matrix.python == '2.7' || matrix.python == '3.5'
30+
run: |
31+
curl -s https://codecov.io/bash | bash -s -- \
32+
-t ${{ secrets.CODECOV_TOKEN }} \
33+
-f coverage.xml \
34+
-F python${{ matrix.python }} \
35+
-Z
36+
37+
- name: Upload coverage to Codecov
38+
if: matrix.python != '2.7' && matrix.python != '3.5'
39+
uses: codecov/codecov-action@v5
40+
with:
41+
token: ${{ secrets.CODECOV_TOKEN }}
42+
slug: marshallward/f90nml
43+
44+
modern:
45+
runs-on: ${{ matrix.os }}
846
strategy:
947
matrix:
10-
os:
11-
- macos-latest
12-
- windows-latest
13-
- ubuntu-18.04
14-
- ubuntu-20.04
15-
python:
16-
- "2.7"
17-
- "3.5"
18-
- "3.6"
19-
- "3.7"
48+
os: [ubuntu-latest, macos-latest, windows-latest]
49+
python-version:
2050
- "3.8"
2151
- "3.9"
2252
- "3.10"
@@ -26,26 +56,24 @@ jobs:
2656
- "pypy-3.9"
2757
- "pypy-3.10"
2858
steps:
29-
- uses: actions/checkout@v3
30-
31-
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v2
33-
with:
34-
python-version: ${{ matrix.python-version }}
35-
36-
- name: Install dependencies
37-
run: |
38-
python -m pip install --upgrade pip
39-
pip install -r tests/requirements_test.txt
40-
pip install pytest pytest-cov
41-
42-
- name: Main test
43-
shell: bash
44-
run: |
45-
pytest --cov --cov-branch --cov-report=xml
46-
47-
- name: Upload coverage reports to Codecov
48-
uses: codecov/codecov-action@v5
49-
with:
50-
token: ${{ secrets.CODECOV_TOKEN }}
51-
slug: marshallward/f90nml
59+
- uses: actions/checkout@v3
60+
61+
- name: Set up Python ${{ matrix.python-version }}
62+
uses: actions/setup-python@v5
63+
with:
64+
python-version: ${{ matrix.python-version }}
65+
66+
- name: Install dependencies
67+
run: |
68+
python -m pip install --upgrade pip
69+
pip install -r tests/requirements_test.txt
70+
pip install pytest pytest-cov
71+
72+
- name: Run tests
73+
run: pytest --cov --cov-branch --cov-report=xml
74+
75+
- name: Upload coverage to Codecov
76+
uses: codecov/codecov-action@v5
77+
with:
78+
token: ${{ secrets.CODECOV_TOKEN }}
79+
slug: marshallward/f90nml

0 commit comments

Comments
 (0)