-
Notifications
You must be signed in to change notification settings - Fork 7
171 lines (148 loc) · 6.31 KB
/
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
name: Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
env:
GEANT4_GIT_TAG: v11.3.0
GEANT4_SOURCE_DIR: geant4_source
GEANT4_BUILD_DIR: geant4_build
GEANT4_INSTALL_DIR: geant4_install
XERCES_C_GIT_REF: 53c0401812bfe5523594c1180f5ac7c758a2eaf7
XERCES_C_SOURCE_DIR: xerces-c_source
XERCES_C_BUILD_DIR: xerces-c_build
XERCES_C_INSTALL_DIR: xerces-c_install
jobs:
run_tests:
name: Tests on ${{ matrix.os }}/${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.9", "3.13"]
exclude:
- os: macos-latest
python-version: "3.9"
- os: windows-latest
python-version: "3.9"
steps:
- name: Cache Geant4 install
uses: actions/cache@v4
id: g4cache
with:
path: ${{ github.workspace }}/${{ env.GEANT4_INSTALL_DIR }}
key: ${{ env.GEANT4_GIT_TAG }}-${{ env.XERCES_C_GIT_REF }}
- name: Cache xerces-c install
uses: actions/cache@v4
id: xerces-cache
with:
path: ${{ github.workspace }}/${{ env.XERCES_C_INSTALL_DIR }}
key: ${{ env.XERCES_C_GIT_REF }}
- uses: actions/checkout@v4
if: steps.g4cache.outputs.cache-hit != 'true'
with:
repository: Geant4/geant4
ref: ${{ env.GEANT4_GIT_TAG }}
path: ${{ env.GEANT4_SOURCE_DIR }}
- uses: actions/checkout@v4
if: steps.xerces-cache.outputs.cache-hit != 'true'
with:
repository: apache/xerces-c
ref: ${{ env.XERCES_C_GIT_REF }}
path: ${{ env.XERCES_C_SOURCE_DIR }}
- uses: lukka/get-cmake@latest
if: steps.g4cache.outputs.cache-hit != 'true' || steps.xerces-cache.outputs.cache-hit != 'true'
- name: CMake configure xerces-c Unix
if: steps.xerces-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
run: >
cmake -E env CXXFLAGS="-fPIC"
cmake -E env CFLAGS="-fPIC"
cmake
-Dnetwork-accessor=socket
-Dtranscoder=iconv
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/${{ env.XERCES_C_INSTALL_DIR }}"
-S "${{ github.workspace }}/${{ env.XERCES_C_SOURCE_DIR }}"
-B "${{ github.workspace }}/${{ env.XERCES_C_BUILD_DIR }}"
- name: CMake configure xerces-c Windows
if: steps.xerces-cache.outputs.cache-hit != 'true' && runner.os == 'Windows'
run: >
cmake
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_CXX_FLAGS_RELEASE="/MT"
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/${{ env.XERCES_C_INSTALL_DIR }}"
-S "${{ github.workspace }}/${{ env.XERCES_C_SOURCE_DIR }}"
-B "${{ github.workspace }}/${{ env.XERCES_C_BUILD_DIR }}"
- name: CMake build xerces-c
if: steps.xerces-cache.outputs.cache-hit != 'true'
run: |
cmake --build "${{ github.workspace }}/${{ env.XERCES_C_BUILD_DIR }}" --config Release
cmake --build "${{ github.workspace }}/${{ env.XERCES_C_BUILD_DIR }}" --config Release --target install
- name: CMake configure Geant4 Unix
if: steps.g4cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
run: >
cmake -E env CXXFLAGS="-fPIC"
cmake -E env CFLAGS="-fPIC"
cmake
-GNinja
-DBUILD_STATIC_LIBS=ON
-DBUILD_SHARED_LIBS=OFF
-DGEANT4_INSTALL_EXAMPLES=OFF
-DGEANT4_USE_SYSTEM_EXPAT=OFF
-DGEANT4_USE_GDML=ON
-DGEANT4_BUILD_TLS_MODEL=global-dynamic
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/${{ env.XERCES_C_INSTALL_DIR }}"
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/${{ env.GEANT4_INSTALL_DIR }}"
-S "${{ github.workspace }}/${{ env.GEANT4_SOURCE_DIR }}"
-B "${{ github.workspace }}/${{ env.GEANT4_BUILD_DIR }}"
- name: CMake configure Geant4 Windows
if: steps.g4cache.outputs.cache-hit != 'true' && runner.os == 'Windows'
run: >
cmake
-DBUILD_STATIC_LIBS=ON
-DBUILD_SHARED_LIBS=OFF
-DGEANT4_INSTALL_EXAMPLES=OFF
-DGEANT4_USE_GDML=ON
-DGEANT4_BUILD_TLS_MODEL=global-dynamic
-DGEANT4_USE_OPENGL_WIN32=ON
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/${{ env.XERCES_C_INSTALL_DIR }}"
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/${{ env.GEANT4_INSTALL_DIR }}"
-S "${{ github.workspace }}/${{ env.GEANT4_SOURCE_DIR }}"
-B "${{ github.workspace }}/${{ env.GEANT4_BUILD_DIR }}"
- name: CMake build Geant4
if: steps.g4cache.outputs.cache-hit != 'true'
run: |
cmake --build "${{ github.workspace }}/${{ env.GEANT4_BUILD_DIR }}" --config Release
cmake --build "${{ github.workspace }}/${{ env.GEANT4_BUILD_DIR }}" --config Release --target install
- name: Setup environment variables
shell: bash
run: |
echo "${{ github.workspace }}/${{ env.GEANT4_INSTALL_DIR }}/bin" >> $GITHUB_PATH
echo "HOME=${{ github.workspace }}" >> $GITHUB_ENV
echo "CMAKE_ARGS=-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=${{ github.workspace }}/${{ env.XERCES_C_INSTALL_DIR }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: true
path: ${{ github.event.repository.name }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Add Python requirements
run: python -m pip install --upgrade setuptools psutil
- name: Install ${{ github.event.repository.name }}
run: python -m pip install "${{ github.workspace }}/${{ github.event.repository.name }}"
- name: Cache Geant4 datasets
uses: actions/cache@v4
with:
key: ${{ env.GEANT4_GIT_TAG }}-datasets
path: ${{ github.workspace }}/.geant4_pybind
enableCrossOsArchive: true
- name: Run B1 (sanity) test
run: python ${{ github.event.repository.name }}/tests/test_B1.py
- name: Run example tests
run: python ${{ github.event.repository.name }}/tests/test_examples.py