Skip to content

Commit

Permalink
Test all maintained Python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcgcg committed Nov 27, 2023
1 parent 5e3b65b commit 47868c0
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ jobs:
strategy:
matrix:
include:
- py-version: '3.8'
c-compiler: 'gcc'
cxx-compiler: 'g++'
- py-version: '3.9'
c-compiler: 'gcc'
cxx-compiler: 'g++'
- py-version: '3.10'
c-compiler: 'gcc'
cxx-compiler: 'g++'
Expand Down Expand Up @@ -48,7 +54,7 @@ jobs:
uses: actions/cache/restore@v3
with:
path: /home/runner/.cache/ccache
key: ccache-${{ matrix.c-compiler }}-${{ matrix.py-version }}
key: ccache-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}

- uses: actions/setup-python@v4
if: always()
Expand Down Expand Up @@ -80,52 +86,52 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete ccache-${{ matrix.c-compiler}}-${{ matrix.py-version }} --confirm
gh actions-cache delete ccache-${{ runner.os }}-${{ matrix.c-compiler}}-${{ matrix.py-version }} --confirm
continue-on-error: true

- name: Push ccache cache
if: always()
uses: actions/cache/save@v3
with:
path: /home/runner/.cache/ccache
key: ccache-${{ matrix.c-compiler }}-${{ matrix.py-version }}
key: ccache-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}

- name: Ccache report
if: always()
run: ccache -s

- name: Run tests
if: always()
run: python3 -m pytest --junit-xml=test-results-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml tests/
run: python3 -m pytest --junit-xml=test-results-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml tests/

- name: Run flake8
if: always()
run: |
make flake8
mv flake8.xml flake8-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
mv flake8.xml flake8-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
- name: Archive test results
uses: actions/upload-artifact@v3
if: always()
with:
name: Test results
path: test-results-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
path: test-results-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml

- name: Report test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Test report (${{ matrix.c-compiler }}, Python ${{ matrix.py-version }})
path: test-results-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
name: Test report (${{ runner.os }}, ${{ matrix.c-compiler }}, Python ${{ matrix.py-version }})
path: test-results-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
reporter: java-junit
fail-on-error: true

- name: Report flake8 results
uses: dorny/test-reporter@v1
if: always()
with:
name: Flake8 report (${{ matrix.c-compiler }}, Python ${{ matrix.py-version }})
path: flake8-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
name: Flake8 report (${{ runner.os }}, ${{ matrix.c-compiler }}, Python ${{ matrix.py-version }})
path: flake8-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
reporter: java-junit
fail-on-error: false

Expand Down Expand Up @@ -157,7 +163,7 @@ jobs:
uses: actions/cache/restore@v3
with:
path: /Users/runner/Library/Caches/ccache
key: ccache-mac-${{ matrix.py-version }}
key: ccache-${{ runner.os }}-${{ matrix.py-version }}

- name: Setup GNU Fortran
uses: modflowpy/install-gfortran-action@v1
Expand Down Expand Up @@ -189,36 +195,36 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete ccache-mac-${{ matrix.py-version }} --confirm
gh actions-cache delete ccache-${{ runner.os }}-${{ matrix.py-version }} --confirm
continue-on-error: true

- name: Push ccache cache
if: always()
uses: actions/cache/save@v3
with:
path: /Users/runner/Library/Caches/ccache
key: ccache-mac-${{ matrix.py-version }}
key: ccache-${{ runner.os }}-${{ matrix.py-version }}

- name: Ccache report
if: always()
run: ccache -s

- name: Run tests
if: always()
run: python3 -m pytest --junit-xml=test-results-Mac-${{ matrix.py-version }}.xml tests/
run: python3 -m pytest --junit-xml=test-results-${{ runner.os }}-${{ matrix.py-version }}.xml tests/

- name: Archive test results
uses: actions/upload-artifact@v3
if: always()
with:
name: Test results
path: test-results-${{ matrix.py-version }}.xml
path: test-results-${{ runner.os }}-${{ matrix.py-version }}.xml

- name: Report test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Test report (Mac, Python ${{ matrix.py-version }})
path: test-results-Mac-${{ matrix.py-version }}.xml
name: Test report (${{ runner.os }}, Python ${{ matrix.py-version }})
path: test-results-${{ runner.os }}-${{ matrix.py-version }}.xml
reporter: java-junit
fail-on-error: true

0 comments on commit 47868c0

Please sign in to comment.