-
Notifications
You must be signed in to change notification settings - Fork 3
122 lines (105 loc) · 4 KB
/
test-matrix.yml
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
name: Test Matrix
on:
pull_request:
paths:
- '**/*.py'
- '**/*.cpp'
- '**/*.hpp'
- '**/*.ipynb'
- '**/*.c'
- '**/*.h'
- '**/*.toml'
- '.github/workflows/test-matrix.yml' # run if this file is changed
- '!docs/conf.py'
workflow_dispatch:
permissions:
contents: read
jobs:
platforms:
strategy:
fail-fast: false
matrix:
version: ["3.9", "3.10", "3.11", "3.12"]
os: [windows-latest, macOS-13, macOS-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Setup | Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.codecov.io:443
api.github.com:443
cli.codecov.io:443
codecov.io:443
files.pythonhosted.org:443
github.com:443
pypi.org:443
storage.googleapis.com:443
uploader.codecov.io:443
- name: Setup | Check out the commit
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup | Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.version }}
- name: Setup | Install dependencies
run: |
python3 -m pip install --upgrade pip
- name: Action | Test installation
run: python3 -m pip install .[formats,examples,tests]
- name: Action | Test package and examples
run: |
python3 -m pytest --nbmake --disable-warnings --no-header --color=auto examples/ tests/ >> $GITHUB_STEP_SUMMARY
- name: Action | Test uninstall process
# Allow upload to codecov to fail but not fail all tests
run: python3 -m pip uninstall -y sansmic
coverage:
runs-on: ubuntu-latest
steps:
- name: Setup | Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.codecov.io:443
api.github.com:443
cli.codecov.io:443
codecov.io:443
files.pythonhosted.org:443
github.com:443
pypi.org:443
storage.googleapis.com:443
uploader.codecov.io:443
- name: Setup | Check out the commit
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup | Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.12'
- name: Setup | Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install gcovr==5.0
- name: Setup | Install editable build
run: python3 -m pip install -e .[formats,examples,tests]
- name: Action | Test package and examples and get coverage results
run: |
export CPPFLAGS="-coverage"
python3 setup.py build_ext --inplace --force
echo '### Run tests' >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
python3 -m pytest --nbmake --disable-warnings --cov=sansmic --cov=tests --no-header --color=auto examples/ tests/ | tee -a $GITHUB_STEP_SUMMARY
find src -type f -name '*.cpp' | xargs -I{} gcov -o build/temp*/src/ext_modules/libsansmic {}
echo ' ' >> $GITHUB_STEP_SUMMARY
gcovr --txt -s -k | tee -a $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Action | Upload coverage reports to Codecov
if: success() || failure()
continue-on-error: true
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}