-
-
Notifications
You must be signed in to change notification settings - Fork 60
132 lines (116 loc) · 3.66 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
---
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: ''
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_runs:
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:
os: [ubuntu-latest]
python-version: ['3.8', '3.11']
steps:
- name: Checkout sisl
uses: actions/checkout@v4
with:
ref: '${{ github.event.inputs.branch }}'
# The files submodule is required for tests purposes
submodules: true
# the 'files' submodule uses lfs
lfs: true
- name: Print-out commit information
run: |
echo "branch: ${{ github.event.inputs.branch }}"
echo "hash: ${{ github.sha }}"
echo "python-version: ${{ matrix.python-version }}"
# This should generally not be required, but in the end it is just easier
- name: Ensure system dependencies
run: |
sudo apt-get update
sudo apt-get install gcc gfortran
- name: Python installation
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install sisl + dependencies
run: |
python -m pip install --progress-bar=off --upgrade pip
python -m pip install --progress-bar=off Cython "scikit-build-core[pyproject]"
python -m pip install --progress-bar=off -r ci/requirements.txt -r ci/requirements-viz.txt -r requirements.txt
CC=gcc FC=gfortran python -m pip install -vvv .
- name: Running sisl tests
env:
SISL_FILES_TESTS: ${{ github.workspace }}/files/tests
run: |
# This needs to be done in a separate folder
# Otherwise the import will try to use the one in the current folder
mkdir sisl-test-dir ; cd sisl-test-dir
if [[ "${{ github.event.inputs.marks }}" == "" ]]; then
ADD_FLAGS=""
else
ADD_FLAGS="-m ${{ github.event.inputs.marks }}"
fi
# --cov forces the reading of .coveragerc
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
py.test -vv -rX --cov --cov-report term-missing --cov-report xml --cov-config=../.coveragerc $ADD_FLAGS --pyargs sisl $ADD_TOOLS
#cp coverage.xml ../
- name: Upload code-coverage
if: ${{ github.event.inputs.marks == '' }}
uses: codecov/codecov-action@v3
with:
directory: ./sisl-test-dir/
verbose: true