forked from OpenTOPAS/OpenTOPAS
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (148 loc) · 5.56 KB
/
ci.yml
File metadata and controls
163 lines (148 loc) · 5.56 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
name: CI
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
pull_request:
branches:
- main
jobs:
build:
strategy:
matrix:
include:
- name: Ubuntu
os: ubuntu-latest
qt_path: /usr/lib/qt5
make_command: make -j$(nproc) install
make_environment:
export LD_LIBRARY_PATH=$HOME/OpenTOPAS-install/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/geant4-install/lib:$LD_LIBRARY_PATH
install_dependencies_command: |
sudo apt-get update
sudo apt install -y cmake \
libexpat1-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libxt-dev \
xorg-dev \
build-essential \
libharfbuzz-dev \
qtbase5-dev \
qtchooser \
qt5-qmake \
qtbase5-dev-tools
- name: MacOS
os: macos-latest
qt_path: /opt/homebrew/opt/qt@5
make_command: make -j$(sysctl -n hw.logicalcpu) install
make_environment:
export DYLD_LIBRARY_PATH=$HOME/OpenTOPAS-install/lib:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$HOME/geant4-install/lib:$DYLD_LIBRARY_PATH
install_dependencies_command: |
brew install qt@5 xquartz
extra_gdcm_cmake_options: |
-DCMAKE_INSTALL_RPATH=@loader_path \
-DCMAKE_MACOSX_RPATH=ON
name: Build and Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: ${{ matrix.install_dependencies_command }}
shell: bash
- name: Cache Geant4 data
uses: actions/cache@v4
id: cache-data
with:
path: ~/geant4-data
key: ${{ runner.os }}-geant4-data-v11.1.3-${{ hashFiles('.github/workflows/g4data_urls.txt') }}
- name: Download Geant4 data
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
mkdir -p $HOME/geant4-data
cd $HOME/geant4-data
while read url; do
wget "$url"
done < $GITHUB_WORKSPACE/.github/workflows/g4data_urls.txt
for file in *.tar.gz; do
tar -xzf "$file"
rm "$file"
done
shell: bash
- name: Clone and install Geant4
run: |
cd $HOME
git clone https://github.com/Geant4/geant4 --branch v11.1.3
mkdir geant4-build && cd geant4-build
cmake ../geant4 -DGEANT4_INSTALL_DATA=OFF \
-DGEANT4_BUILD_MULTITHREADED=ON \
-DCMAKE_PREFIX_PATH=${{ matrix.qt_path }} \
-DGEANT4_USE_QT=ON \
-DGEANT4_USE_OPENGL_X11=ON \
-DGEANT4_USE_RAYTRACER_X11=ON \
-DCMAKE_INSTALL_PREFIX=$HOME/geant4-install
${{ matrix.make_command }}
shell: bash
- name: Compile GDCM
run: |
cp gdcm-2.6.8.tar.gz $HOME/
cd $HOME
tar -zxf gdcm-2.6.8.tar.gz
mkdir gdcm-{build,install}
cd gdcm-build
cmake ../gdcm-2.6.8 -DGDCM_BUILD_SHARED_LIBS=ON\
-DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF\
-DCMAKE_INSTALL_PREFIX=../gdcm-install\
${{ matrix.extra_gdcm_cmake_options }}
${{ matrix.make_command }}
shell: bash
- name: Compile TOPAS and add to PATH
run: |
cd $HOME
mkdir OpenTOPAS-{build,install}
cd OpenTOPAS-build
export Geant4_DIR=$HOME/geant4-install/
export GDCM_DIR=$HOME/gdcm-install/
cmake $GITHUB_WORKSPACE -DCMAKE_INSTALL_PREFIX=../OpenTOPAS-install
${{ matrix.make_command }}
echo "$(readlink -f $HOME/OpenTOPAS-install/bin/)" >> $GITHUB_PATH
shell: bash
- name: Install nrtest and nrtest-topas
run: |
python3 -m venv $HOME/nrtest-env
source $HOME/nrtest-env/bin/activate
python3 -m pip install nrtest
python3 -m pip install git+https://github.com/davidchall/nrtest-topas.git
shell: bash
- name: Clone qi-test and add configuration file
run: |
git clone https://github.com/OpenTOPAS/qi-opentopas.git
cp $GITHUB_WORKSPACE/testing/qi-topas-v4.0.json ./qi-opentopas/apps/
shell: bash
- name: Run nrtest
id: test_results
run: |
cd qi-opentopas
TODAY=$(date +%Y-%m-%d)
export TOPAS_G4_DATA_DIR=$HOME/geant4-data
${{ matrix.make_environment }}
echo $(which topas)
source $HOME/nrtest-env/bin/activate
nrtest execute apps/qi-topas-v4.0.json tests/ -o benchmark/$TODAY
python $GITHUB_WORKSPACE/testing/parse_test_results.py benchmark/$TODAY/manifest.json >> "$GITHUB_OUTPUT"
shell: bash
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: nrtest-results-${{ matrix.os }}
path: qi-opentopas/benchmark/
- name: Check test results
if: steps.test_results.outputs.all_tests_passed != 'true'
run: |
echo "Results: ${{ steps.test_results.outputs.passed_tests }}/${{ steps.test_results.outputs.total_tests }} passed" >> $GITHUB_STEP_SUMMARY
exit 1