-
-
Notifications
You must be signed in to change notification settings - Fork 60
189 lines (169 loc) · 5.25 KB
/
test.yaml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
name: Coverage test
defaults:
run:
shell: bash
env:
CFLAGS: -Og
on:
push:
branches: [main]
paths:
- '**.py'
- '**.ipynb'
pull_request:
paths:
- '**.py'
- '**.ipynb'
schedule:
# only once every 4 days
# We can always force run this.
- cron: '37 10 */4 * *'
workflow_dispatch:
inputs:
branch:
description: 'Which branch to test'
required: false
default: 'main'
marks:
description: 'Which marks to test'
required: false
default: ''
verbose:
description: 'Run pytest with -vvv'
required: false
type: boolean
jobs:
# Define a few jobs that can be runned
lint:
uses: ./.github/workflows/linter.yml
runnable:
if: |
github.event_name == 'schedule'
&& github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: '${{ github.event.inputs.branch }}'
- run: test -n $(git rev-list --after="1 week" --max-count=1 ${{ github.sha }})
test:
needs: [lint, runnable]
if: |
always() &&
contains(needs.lint.result, 'success') &&
(contains(needs.runnable.result, 'success') || contains(needs.runnable.result, 'skipped'))
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.9', '3.13']
full-test: [true, false]
minimal-dep: [true, false]
os: [ubuntu-latest, macos-13, macos-latest]
exclude:
# only full test suite on 3.13
- python-version: '3.13'
full-test: false
# no minimal dependency on 3.13
- python-version: '3.13'
minimal-dep: true
# minimal dependency on ARM does not make sense (wheels not present)
- os: macos-latest
minimal-dep: true
# only run full test suite for minimal-dependency checks
- full-test: false
minimal-dep: true
steps:
- name: Checkout sisl
uses: actions/checkout@v4
with:
ref: '${{ github.event.inputs.branch }}'
# The files submodule is required for tests purposes
submodules: ${{ matrix.full-test }}
# the 'files' submodule uses lfs
lfs: ${{ matrix.full-test }}
- name: Ensure fortran
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: 11
- name: Print-out commit information
id: info
run: |
echo "branch: ${{ github.event.inputs.branch }}"
echo "hash: ${{ github.sha }}"
echo "python-version: ${{ matrix.python-version }}"
# Put stuff in the environment
#
# Test everything including LSF files submodule?
if [[ "${{ matrix.full-test }}" == "true" ]]; then
echo "sisl_extras=test,viz" >> $GITHUB_OUTPUT
else
echo "sisl_extras=test" >> $GITHUB_OUTPUT
fi
# Test minimal versioning?
if [[ "${{ matrix.minimal-dep }}" == "true" ]]; then
echo "sisl_install_packages='numpy==1.21.*' 'scipy==1.6.*' 'xarray==0.21.*'" >> $GITHUB_OUTPUT
else
echo "sisl_install_packages=" >> $GITHUB_OUTPUT
fi
- name: Python installation
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: |
python -m pip install --progress-bar=off --upgrade pip
- name: Python minimal versions
if: ${{ matrix.minimal-dep }}
run: |
python -m pip install --progress-bar=off -v ${{ steps.info.outputs.sisl_install_packages }}
- name: Install sisl + dependencies
env:
SKBUILD_CMAKE_ARGS: -DWITH_COVERAGE:bool=true;-DWITH_LINE_DIRECTIVES:bool=true
CC: gcc
FC: gfortran
run: |
python -m pip install --progress-bar=off -v .[${{ steps.info.outputs.sisl_extras }}] \
${{ steps.info.outputs.sisl_install_packages }}
- name: sisl debug info
run: |
python -c 'from sisl._debug_info import * ; print_debug_info()'
- name: sisl import test
run: |
sgeom --help
stoolbox atom-plot --help
- name: sisl tests
env:
SISL_NUM_PROCS: 1
OMP_NUM_THREADS: 1
SISL_FILES_TESTS: ${{ github.workspace }}/files/tests
run: |
ls -al
if [[ "${{ github.event.inputs.marks }}" == "" ]]; then
ADD_FLAGS=""
else
ADD_FLAGS="-m ${{ github.event.inputs.marks }}"
fi
if [[ "${{ github.event.inputs.verbose }}" == "true" ]]; then
ADD_FLAGS="$ADD_FLAGS -vvv"
fi
ADD_TOOLS=""
for tool in btd models ; do
ADD_TOOLS="$ADD_TOOLS sisl_toolbox.$tool"
done
for tool in atom minimizer ; do
ADD_TOOLS="$ADD_TOOLS sisl_toolbox.siesta.$tool"
done
for tool in poisson ; do
ADD_TOOLS="$ADD_TOOLS sisl_toolbox.transiesta.$tool"
done
# Try to enable code-coverage in the tests
coverage run -m pytest --pyargs sisl $ADD_FLAGS $ADD_TOOLS
ls -al
- name: Upload code-coverage
if: ${{ github.event.inputs.marks == '' }}
uses: codecov/codecov-action@v4
with:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}