-
Notifications
You must be signed in to change notification settings - Fork 12
190 lines (162 loc) · 6.4 KB
/
main.yml
File metadata and controls
190 lines (162 loc) · 6.4 KB
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
name: Build & Test
on:
push:
branches:
- main
- "releases/**"
paths-ignore:
- "**.md"
pull_request:
release:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test_on_linux:
name: Test on remage image
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container_version:
- latest
- stable
- slim
container: docker://legendexp/remage-base:${{ matrix.container_version }}
steps:
- uses: actions/checkout@v6
with:
# we need a fully checked-out repo to get version from setuptools-scm.
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request && github.event.pull_request.head.sha || github.ref }}
- name: Build project
shell: bash # make the pipes to tee below propagate errors (pipefail is on by default).
run: |
git config --global --add safe.directory $(pwd) # make git work inside container.
# install some tools for more efficient disk space usage.
pip install uv setuptools-scm
mkdir build
cd build
cmake -DBUILD_TESTING=ON -DRMG_BUILD_DOCS=OFF .. | tee -a build.log
make -j$(nproc) | tee -a build.log
make install | tee -a build.log
- name: post-build cleanup
shell: bash
run: |
echo "freeing some disk space..."
echo "free space before: $(df --output=avail -h -- $(pwd) | tail -n1)"
uv cache clean
pip cache purge
echo "free space after: $(df --output=avail -h -- $(pwd) | tail -n1)"
- name: check version equality
run: |
cd build
cpp_version=$(sed -En "s/-- remage version [0-9.]+ \(([0-9a-z.+_-]+)\)/\\1/p" build.log)
py_version=$(sed -En "s/-- Installed python wrapper Version: ([0-9a-z.+_-]+)/\\1/p" build.log)
if [ "$cpp_version" != "$py_version" ]; then
echo "::error::version numbers of python wrapper ($py_version) and cpp executable ($cpp_version) differ!"
exit 1
fi
- name: Compare checked-in doc dump with current result
if: ${{ matrix.container_version == 'stable' }}
run: |
cd build
cp ../docs/rmg-commands.md ../docs/rmg-commands.md.bak
echo "::group::compile and run remage-doc-dump"
make remage-doc-dump
echo "::endgroup::"
docs_differ=0
docs_diff=$(diff -u ../docs/rmg-commands.md ../docs/rmg-commands.md.bak) || docs_differ=$?
if [ $docs_differ -ne 0 ]; then
echo "::error file=docs/rmg-commands.md::docs/rmg-commands.md is not up-to-date with remage source. please run 'make remage-doc-dump' and commit changes."
echo "$docs_diff"
exit 1
fi
- name: Run full test suite
if: ${{ matrix.container_version != 'slim' }}
run: |
cd build
echo "free space: $(df --output=avail -h -- $(pwd) | tail -n1)"
ctest --label-exclude 'mt|val-only' -j$(nproc) --output-on-failure
echo "free space: $(df --output=avail -h -- $(pwd) | tail -n1)"
ctest --label-regex mt --label-exclude val-only -j1 --output-on-failure
echo "free space: $(df --output=avail -h -- $(pwd) | tail -n1)"
- name: Upload test suite outputs to GitHub
if: ${{ always() && matrix.container_version != 'slim' }}
uses: actions/upload-artifact@v7
with:
name: remage-test-output-g4flavor-${{ matrix.container_version }}
# artifacts must have a ".output*" extension
path: build/tests/**/*.output*.*
- name: Run minimal test suite
if: ${{ matrix.container_version == 'slim' }}
run: |
cd build
ctest --label-exclude 'extra|vis|mt|val-only' -j$(nproc) --output-on-failure
ctest --label-regex mt --label-exclude 'extra|vis|val-only' -j --output-on-failure
- name: Test docs building
if: ${{ matrix.container_version != 'slim' }}
run: |
cd build
cmake -DRMG_BUILD_DOCS=ON ..
make sphinx
echo "free space: $(df --output=avail -h -- $(pwd) | tail -n1)"
- name: Minimally test installed executable
run: |
rm -rf build
export PATH="/usr/local/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
REMAGE_ASSERT_CPP_ORIGIN="config" remage --version
test_on_mac:
name: Test on macOS
runs-on: macos-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v6
with:
# we need a fully checked-out repo to get version from setuptools-scm.
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request && github.event.pull_request.head.sha || github.ref }}
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: "geant4-env"
auto-activate-base: "false"
channels: conda-forge
channel-priority: "strict"
conda-remove-defaults: "true"
- name: Install Geant4 and native dependencies
run: |
# native dependencies for pyg4ometry
brew update
brew install opencascade cgal gmp mpfr boost
conda install conda-forge::geant4 conda-forge::bxdecay0 "conda-forge::python<3.14"
echo "CMAKE_PREFIX_PATH=$CONDA_PREFIX" >> $GITHUB_ENV
- name: Build project
run: |
mkdir build
cd build
cmake \
-D CMAKE_INSTALL_PREFIX=../local \
-D Python3_EXECUTABLE="$(command -v python)" \
-D BUILD_TESTING=ON \
-D RMG_BUILD_DOCS=OFF \
..
make -j$(nproc)
make install
- name: Run full test suite
run: |
cd build
ctest --label-exclude 'mt|val-only' -j$(nproc) --output-on-failure
ctest --label-regex mt --label-exclude val-only -j1 --output-on-failure
- name: Minimally test installed executable
run: |
rm -rf build
export PATH="$PWD/local/bin:$PATH"
export DYLD_FALLBACK_LIBRARY_PATH="$PWD/local/lib:$CONDA_PREFIX/lib:$DYLD_FALLBACK_LIBRARY_PATH"
REMAGE_ASSERT_CPP_ORIGIN="config" remage --version
# vim: expandtab tabstop=2 shiftwidth=2