-
Notifications
You must be signed in to change notification settings - Fork 8
216 lines (195 loc) · 9.62 KB
/
unit_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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Unit test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- "trunk"
workflow_dispatch:
defaults:
run:
shell: bash -leo pipefail {0}
# Use multiple jobs to reduce the amount of time spent on GPU runners. Use GitHub Hosted runners
# for compiling all tests configurations (GPU and CPU), then upload the installation directory
# as an artifact. Test jobs depend on the build job, download the install directory, and run the
# tests. Upload each build configuration to a separate artifact.
# Copy and paste the matrix from `build_linux` to `test_linux`. The list in `test_linux` must be a
# subset of the list in `build_linux`.
jobs:
# build_linux:
# name: Build [${{ matrix.image }}]
# runs-on: ubuntu-latest
# container:
# image: ${{ matrix.repository }}/ci:2023.11.27-${{ matrix.image }}
# credentials:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# strategy:
# matrix:
# include:
# - {repository: glotzerlab, image: clang16_py311, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: true }
# - {repository: glotzerlab, image: clang15_py311, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: true }
# - {repository: glotzerlab, image: clang14_py311, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: true }
# - {repository: glotzerlab, image: clang13_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: clang12_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: clang11_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: clang10_py38, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc13_py312, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc12_py311, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc11_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc10_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc9_py39, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: joaander, image: optix65_cuda118_py310, test_runner: [self-hosted,GPU,optix], test_docker_options: '-e NVIDIA_DRIVER_CAPABILITIES=compute,graphics --gpus=all', render_gallery: false }
# steps:
# - uses: actions/[email protected]
# with:
# path: code
# submodules: true
# - name: Configure
# run: |
# mkdir -p build
# cd build
# cmake ../code -GNinja \
# -DENABLE_EMBREE=${ENABLE_EMBREE:-"ON"} \
# -DENABLE_OPTIX=${ENABLE_OPTIX:-"OFF"} \
# -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install
# env:
# ENABLE_OPTIX: ${{ contains(matrix.image, 'optix') }}
# ENABLE_EMBREE: ${{ !contains(matrix.image, 'optix') }}
# - name: Build
# run: ninja install
# working-directory: build
# # Tar the installation directory to preserve permissions and reduce HTTP requests on upload.
# - name: 'Tar install'
# run: tar --use-compress-program='zstd -10 -T0' -cvf install.tar install
# # Upload the tarball. Retain the file for a limited time in case developers need to download
# # and run tests locally for further debugging.
# - uses: actions/[email protected]
# name: 'Upload install'
# with:
# name: install-${{ matrix.image }}-${{ github.sha }}
# path: install.tar
# retention-days: 7
# test_linux:
# needs: build_linux
# runs-on: ${{ matrix.test_runner }}
# container:
# image: ${{ matrix.repository }}/ci:2023.11.27-${{ matrix.image }}
# options: ${{ matrix.test_docker_options }} -e CUDA_VISIBLE_DEVICES
# credentials:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# strategy:
# matrix:
# include:
# - {repository: glotzerlab, image: clang16_py311, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: true }
# - {repository: glotzerlab, image: clang15_py311, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: true }
# - {repository: glotzerlab, image: clang14_py311, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: true }
# - {repository: glotzerlab, image: clang13_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: clang12_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: clang11_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: clang10_py38, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc13_py312, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc12_py311, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc11_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc10_py310, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: glotzerlab, image: gcc9_py39, test_runner: ubuntu-latest, test_docker_options: '', render_gallery: false }
# - {repository: joaander, image: optix65_cuda118_py310, test_runner: [self-hosted,GPU,optix], test_docker_options: '-e NVIDIA_DRIVER_CAPABILITIES=compute,graphics --gpus=all', render_gallery: false }
# steps:
# - name: Clean workspace
# run: ( shopt -s dotglob nullglob; rm -rf ./* )
# shell: bash
# - uses: actions/[email protected]
# with:
# name: install-${{ matrix.image }}-${{ github.sha }}
# - name: Untar install
# run: tar --use-compress-program='zstd -10 -T0' -xvf install.tar
# - name: Run tests
# run: python3 -m pytest --pyargs fresnel -v --log-level=DEBUG --durations=0 --durations-min=0.1
# env:
# PYTHONPATH: ${{ github.workspace }}/install
# - uses: actions/[email protected]
# if: ${{ matrix.render_gallery }}
# with:
# submodules: true
# path: code
# - name: Render gallery images
# if: ${{ matrix.render_gallery }}
# run: for i in *.py; do echo "Rendering $i" && python3 $i || exit 1; done
# working-directory: code/doc/gallery
# env:
# PYTHONPATH: ${{ github.workspace }}/install
# - name: Clean workspace
# run: ( shopt -s dotglob nullglob; rm -rf ./* )
# shell: bash
# - name: Clean HOME
# run: ( shopt -s dotglob nullglob; rm -rf $HOME/* )
# shell: bash
build_test:
name: Unit test [py${{ matrix.python }} ${{ matrix.os }}]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
python: ['39', '310', '311', '312']
include:
# Render gallery images in one configuration
- os: 'ubuntu-24.04'
python: '312'
render_gallery: true
# Test macOS and windows on oldest and latest versions.
- os: 'macos-14'
python: '312'
- os: 'windows-2022'
python: '312'
cmake_generator: "Visual Studio 17 2022"
- os: 'windows-2022'
python: '39'
cmake_generator: "Visual Studio 17 2022"
- os: 'windows-2019'
python: '39'
cmake_generator: "Visual Studio 16 2019"
- os: 'macos-14'
python: '39'
steps:
- uses: actions/[email protected]
with:
path: code
submodules: true
- name: Create Python Environment
uses: mamba-org/[email protected]
with:
micromamba-version: '1.5.8-0'
environment-name: test
environment-file: code/.github/workflows/environments/py${{ matrix.python }}-conda-lock.yml
- name: Configure
run: >
cmake -S code -B build
-DENABLE_EMBREE=ON
-DENABLE_OPTIX=OFF
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON
env:
CMAKE_PREFIX_PATH: ${{ github.workspace }}\env
- name: Build
run: cmake --build build --config Release -j
- name: Install
run: cmake --install build --config Release
- name: Run tests
run: python -m pytest --pyargs fresnel -v --log-level=DEBUG --durations=0 --durations-min=0.1
- name: Render gallery images
if: ${{ matrix.render_gallery }}
run: for i in *.py; do echo "Rendering $i" && python3 $i || exit 1; done
working-directory: code/doc/gallery
# This job is used to provide a single requirement for branch merge conditions.
# tests_complete:
# name: Unit test
# if: always()
# needs: [build_linux, test_linux, build_test]
# runs-on: ubuntu-latest
# steps:
# - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
# - name: Done
# run: echo "Done."