-
Notifications
You must be signed in to change notification settings - Fork 1
175 lines (166 loc) · 5.94 KB
/
regression-tests.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
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
# This workflow will install and then lint the code with Flake8 and Pylint.
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Regression Tests
on:
push:
branches: ['master', 'devel']
pull_request:
branches: '*'
jobs:
pure-pip-installation:
# This stage only tests if the installation is possible.
# The evironment created herein will be discared and re-created in the test stage.
runs-on: ubuntu-latest
strategy:
matrix:
# Add multiple Python versions here to run tests on new(er) versions.
python-version: ["3.10"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Build and install
run: |
python -m pip install --upgrade pip
# Install with -e (in editable mode) to allow the tracking of the test coverage
pip install -e .
# Check result of installation
python -c "import loadskernel"
which loads-kernel
which model-viewer
which loads-compare
conda-and-pip-installation:
# This stage only tests if the installation is possible.
# The evironment created herein will be discared and re-created in the test stage.
runs-on: ubuntu-latest
strategy:
matrix:
# Add multiple Python versions here to run tests on new(er) versions.
python-version: ["3.10", "3.11"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Build and install
run: |
# Install same requirements as to be used during regression testing
source $CONDA/etc/profile.d/conda.sh
conda activate
conda install -y -c conda-forge --file ./tests/requirements.txt
# Install with -e (in editable mode) to allow the tracking of the test coverage
pip install -e .
# Check result of installation
python -c "import loadskernel"
which loads-kernel
which model-viewer
which loads-compare
Pytest:
runs-on: ubuntu-latest
strategy:
matrix:
# Add multiple Python versions here to run tests on new(er) versions.
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install the package itself to make sure that all imports work.
pip install -e .
- name: Analysing the code with pytest
run: |
# Run the actual testing of the code with pytest
# Using python -m pytest is necessary because pytest has the habit of not looking in the site-packages of the venv
python -m pytest -v --basetemp=./tmp -k test_dummy --cov=loadskernel --cov=modelviewer --cov=loadscompare --junitxml=testresult.xml
# Create some reports
coverage report
coverage xml -o coverage.xml
coverage html --directory ./coverage/coverage
- name: Upload test restults and coverage as an artifact
uses: actions/upload-artifact@v4
with:
name: test results and coverage
path: |
testresult.xml
coverage.xml
coverage
if-no-files-found: ignore
Jupyter:
runs-on: ubuntu-latest
strategy:
matrix:
# Select Python version to be used for compiling here.
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install the package itself to make sure that all imports work.
pip install .
- name: Assemble the tutorials to a jupyter book and build htlm pages
run: |
jupyter-book build ./doc/tutorials
# Put the html into a 2nd-level sub-folder and use 1st-level subfolder for uploading
mkdir ./doc/html
mv ./doc/tutorials/_build/html ./doc/html/tutorials
- name: Upload Jupyter book as an artifact
uses: actions/upload-artifact@v4
with:
name: tutorials
path: ./doc/html
if-no-files-found: ignore
combine-pages:
runs-on: ubuntu-latest
# Add a dependency to the build job
needs: [Jupyter, Pytest]
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: See what we've got
run: |
ls -la
#tar -xf artifact.tar
#ls -la
- name: Upload subdirectories for pages
# This is not a normal artifact but one that can be deployed to the GitHub pages in the next step
uses: actions/upload-pages-artifact@v3
with:
name: github-pages # This name may not be changed according to the documentation
path: |
./tutorials
./coverage
if-no-files-found: ignore
deploy-pages:
# Add a dependency to the build job
needs: combine-pages
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup GitHub Pages
uses: actions/configure-pages@v4
- name: Deploy to Pages
id: deployment
uses: actions/deploy-pages@v4