-
Notifications
You must be signed in to change notification settings - Fork 21
154 lines (126 loc) · 4.86 KB
/
Copy pathtesting.yml
File metadata and controls
154 lines (126 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# This workflow will install Python dependencies and run tests with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Unit tests
on:
push:
branches: [ devel, main ]
paths:
- 'psydac/**'
- 'pyproject.toml'
pull_request:
branches: [ devel, main ]
types:
- ready_for_review
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, macos-14 ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
isMerge:
- ${{ github.event_name == 'push' && github.ref == 'refs/heads/devel' }}
exclude:
- { isMerge: false, python-version: '3.10', os: macos-14 }
- { isMerge: false, python-version: '3.11', os: ubuntu-24.04 }
- { isMerge: false, python-version: '3.12', os: macos-14 }
- { isMerge: false, python-version: '3.13', os: ubuntu-24.04 }
- { isMerge: false, python-version: '3.14', os: macos-14 }
name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
env:
OMP_NUM_THREADS: 2
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml
- name: Install non-Python dependencies on Ubuntu
if: matrix.os == 'ubuntu-24.04'
uses: ./.github/actions/ubuntu_installations
- name: Install non-Python dependencies on macOS
if: matrix.os == 'macos-14'
uses: ./.github/actions/macos_installations
- name: Print information on MPI and HDF5 libraries
run: |
ompi_info
h5pcc -showconfig -echo || true
- name: Upgrade pip, setuptools, and wheel
run: |
pip install --upgrade pip setuptools wheel
- name: Install PETSc and petsc4py with complex support
uses: ./.github/actions/install_petsc4py
- name: Install h5py in parallel mode
uses: ./.github/actions/install_h5py
- name: Install project
run: |
pip install .[test]
pip freeze
- name: Initialize test directory
run: |
mkdir scratch
- name: Test Pyccel optimization flags
working-directory: ./scratch
run: >-
cp $GITHUB_WORKSPACE/psydac/pytest.toml . &&
pytest --pyargs psydac -m pyccel --capture=no
- name: Verify that 'psydac test' reports failures correctly
working-directory: ./scratch
# We run a test which is not collected by pytest by default, and we expect it to fail.
# If it fails (non-zero), the "echo" runs and the script exits with 0 (success).
# If it passes (zero), the "exit 1" runs and the GitHub Action fails.
run: |
psydac test --mod psydac.cmd.tests.failing_test && { echo "Test passed but should have failed!"; exit 1; } || echo "Test failed as expected."
- name: Run coverage tests on macOS
if: matrix.os == 'macos-14'
working-directory: ./scratch
run: >-
cp $GITHUB_WORKSPACE/psydac/pytest.toml . &&
pytest -n auto
--cov psydac
--cov-report xml
--pyargs psydac -m "not mpi and not petsc" -ra
- name: Run single-process tests with Pytest on Ubuntu
if: matrix.os == 'ubuntu-24.04'
working-directory: ./scratch
run: |
psydac test
- name: Upload coverage report to Codacy
if: matrix.os == 'macos-14'
uses: codacy/codacy-coverage-reporter-action@v1.3.0
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./scratch/coverage.xml
- name: Print detailed coverage results on macOS
if: matrix.os == 'macos-14'
working-directory: ./scratch
run: |
coverage report --ignore-errors --show-missing --sort=cover
- name: Run MPI tests with Pytest
working-directory: ./scratch
run: |
psydac test --mpi
- name: Run single-process PETSc tests with Pytest
working-directory: ./scratch
run: |
psydac test --petsc
- name: Run MPI PETSc tests with Pytest
working-directory: ./scratch
run: |
psydac test --mpi --petsc
- name: Run single-process example tests with Pytest on Ubuntu
if: matrix.os == 'ubuntu-24.04'
working-directory: ./scratch
run: >-
cp $GITHUB_WORKSPACE/psydac/pytest.toml . &&
cp -r $GITHUB_WORKSPACE/examples . &&
python -m pytest examples/feec
- name: Remove test directory
if: always()
run: |
rm -rf scratch