Skip to content

Commit 0c98b3d

Browse files
committed
swipe ci from shiva
1 parent ade6728 commit 0c98b3d

File tree

5 files changed

+600
-0
lines changed

5 files changed

+600
-0
lines changed
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
name: ShivaCI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
15+
# code_style:
16+
# needs: [check_pull_request_is_not_a_draft]
17+
# runs-on: ubuntu-22.04
18+
# steps:
19+
# - name: Checkout Repository
20+
# uses: actions/[email protected]
21+
# with:
22+
# submodules: true
23+
# lfs: false
24+
# - name: Check style
25+
# env:
26+
# DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9
27+
# CMAKE_BUILD_TYPE: Release
28+
# BUILD_AND_TEST_ARGS: --test-code-style
29+
# run: ./scripts/ci_build_and_test.sh
30+
31+
doxygen_check:
32+
runs-on: ubuntu-22.04
33+
steps:
34+
- name: Checkout Repository
35+
uses: actions/[email protected]
36+
with:
37+
submodules: true
38+
lfs: false
39+
- name: Check doxygen
40+
env:
41+
DOCKER_REPOSITORY: geosx/ubuntu:22.04
42+
HOST_CONFIG: hostconfigs/environment.cmake
43+
CMAKE_CXX_COMPILER: /usr/bin/clang++
44+
CMAKE_C_COMPILER: /usr/bin/clang
45+
CMAKE_BUILD_TYPE: Release
46+
BUILD_AND_TEST_ARGS: --test-doxygen
47+
run: ./scripts/ci_build_and_test.sh
48+
49+
50+
code_checks:
51+
runs-on: ubuntu-22.04
52+
steps:
53+
- name: Checkout Repository
54+
uses: actions/[email protected]
55+
with:
56+
submodules: true
57+
lfs: false
58+
- name: code_checks
59+
env:
60+
DOCKER_REPOSITORY: geosx/ubuntu:22.04
61+
HOST_CONFIG: hostconfigs/environment.cmake
62+
CMAKE_CXX_COMPILER: /usr/bin/clang++
63+
CMAKE_C_COMPILER: /usr/bin/clang
64+
CMAKE_BUILD_TYPE: Release
65+
BUILD_AND_TEST_ARGS: --code-checks
66+
run: ./scripts/ci_build_and_test.sh
67+
68+
linux_builds:
69+
name: ${{matrix.name}}
70+
runs-on: ${{matrix.RUNS_ON}}
71+
strategy:
72+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
73+
fail-fast: false
74+
matrix:
75+
include:
76+
- name: RHEL8.9-clang17-dbg (ubi8.9, clang-17.0.6, Debug)
77+
DOCKER_REPOSITORY: geosx/ubi:8.9
78+
RUNS_ON: ubuntu-22.04
79+
CMAKE_CXX_COMPILER: clang++
80+
CMAKE_C_COMPILER: clang
81+
CMAKE_BUILD_TYPE: Debug
82+
83+
- name: RHEL8.9-clang17-rel (ubi8.9, clang-17.0.6, Release)
84+
DOCKER_REPOSITORY: geosx/ubi:8.9
85+
RUNS_ON: ubuntu-22.04
86+
CMAKE_CXX_COMPILER: clang++
87+
CMAKE_C_COMPILER: clang
88+
CMAKE_BUILD_TYPE: Release
89+
90+
- name: RHEL8.9-gcc13-dbg (ubi8.9, gcc 13.2.1, Debug)
91+
DOCKER_REPOSITORY: geosx/ubi:8.9
92+
RUNS_ON: ubuntu-22.04
93+
CMAKE_CXX_COMPILER: /opt/rh/gcc-toolset-13/root/bin/g++
94+
CMAKE_C_COMPILER: /opt/rh/gcc-toolset-13/root/bin/gcc
95+
CMAKE_BUILD_TYPE: Debug
96+
97+
- name: RHEL8.9-gcc13-rel (ubi8.9, gcc 13.2.1, Release)
98+
DOCKER_REPOSITORY: geosx/ubi:8.9
99+
RUNS_ON: ubuntu-22.04
100+
CMAKE_CXX_COMPILER: /opt/rh/gcc-toolset-13/root/bin/g++
101+
CMAKE_C_COMPILER: /opt/rh/gcc-toolset-13/root/bin/gcc
102+
CMAKE_BUILD_TYPE: Release
103+
104+
- name: ubuntu22-gcc11-rel (ubuntu-22, gcc 11.4.0, Release)
105+
DOCKER_REPOSITORY: geosx/ubuntu:22.04
106+
RUNS_ON: ubuntu-22.04
107+
CMAKE_CXX_COMPILER: /usr/bin/g++
108+
CMAKE_C_COMPILER: /usr/bin/gcc
109+
CMAKE_BUILD_TYPE: Release
110+
111+
- name: ubuntu22-clang14-rel (ubuntu-22, clang-14.0.0, Release)
112+
DOCKER_REPOSITORY: geosx/ubuntu:22.04
113+
RUNS_ON: ubuntu-22.04
114+
CMAKE_CXX_COMPILER: /usr/bin/clang++
115+
CMAKE_C_COMPILER: /usr/bin/clang
116+
CMAKE_BUILD_TYPE: Release
117+
118+
- name: ubuntu22-clang14-dbg (ubuntu-22, clang-14.0.0, Debug)
119+
DOCKER_REPOSITORY: geosx/ubuntu:22.04
120+
RUNS_ON: ubuntu-22.04
121+
CMAKE_CXX_COMPILER: /usr/bin/clang++
122+
CMAKE_C_COMPILER: /usr/bin/clang
123+
CMAKE_BUILD_TYPE: Debug
124+
125+
- name: ubuntu22-gcc11-dbg (ubuntu-22, gcc 11.4.0, Release)
126+
DOCKER_REPOSITORY: geosx/ubuntu:22.04
127+
RUNS_ON: ubuntu-22.04
128+
CMAKE_CXX_COMPILER: /usr/bin/g++
129+
CMAKE_C_COMPILER: /usr/bin/gcc
130+
CMAKE_BUILD_TYPE: Debug
131+
132+
- name: ubuntu22-gcc11-cuda11-rel (ubuntu-22, gcc 11.4.0, cuda-11.8.0, Release)
133+
DOCKER_REPOSITORY: geosx/ubuntu:22.04-cuda11.8
134+
RUNS_ON: streak2
135+
CMAKE_CXX_COMPILER: /usr/bin/g++
136+
CMAKE_C_COMPILER: /usr/bin/gcc
137+
CMAKE_BUILD_TYPE: Release
138+
ENABLE_CUDA: ON
139+
CMAKE_CUDA_ARCHITECTURES: "86"
140+
NPROC: 4
141+
DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all"
142+
143+
- name: ubuntu22-gcc11-cuda11-dbg (ubuntu-22, gcc 11.4.0, cuda-11.8.0, Debug)
144+
DOCKER_REPOSITORY: geosx/ubuntu:22.04-cuda11.8
145+
RUNS_ON: streak2
146+
CMAKE_CXX_COMPILER: /usr/bin/g++
147+
CMAKE_C_COMPILER: /usr/bin/gcc
148+
CMAKE_BUILD_TYPE: Debug
149+
ENABLE_CUDA: ON
150+
CMAKE_CUDA_ARCHITECTURES: "86"
151+
NPROC: 4
152+
DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all"
153+
154+
- name: ubuntu22-clang14-cuda11-rel (ubuntu-22, clang-14.0.0, cuda-11.8.0, Release)
155+
DOCKER_REPOSITORY: geosx/ubuntu:22.04-cuda11.8
156+
RUNS_ON: streak2
157+
CMAKE_CXX_COMPILER: /usr/bin/clang++
158+
CMAKE_C_COMPILER: /usr/bin/clang
159+
CMAKE_BUILD_TYPE: Release
160+
ENABLE_CUDA: ON
161+
CMAKE_CUDA_ARCHITECTURES: "86"
162+
NPROC: 4
163+
DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all"
164+
165+
- name: ubuntu22-clang14-cuda11-dbg (ubuntu-22, clang-14.0.0, cuda-11.8.0, Debug)
166+
DOCKER_REPOSITORY: geosx/ubuntu:22.04-cuda11.8
167+
RUNS_ON: streak2
168+
CMAKE_CXX_COMPILER: /usr/bin/clang++
169+
CMAKE_C_COMPILER: /usr/bin/clang
170+
CMAKE_BUILD_TYPE: Debug
171+
ENABLE_CUDA: ON
172+
CMAKE_CUDA_ARCHITECTURES: "86"
173+
NPROC: 4
174+
DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all"
175+
176+
- name: RHEL8.9-clang17-cuda12-rel (ubi8.9, clang-17.0.6, cuda-12.4.1, Release)
177+
DOCKER_REPOSITORY: geosx/ubi:8.9-cuda12.4.1
178+
RUNS_ON: streak2
179+
CMAKE_CXX_COMPILER: clang++
180+
CMAKE_C_COMPILER: clang
181+
CMAKE_BUILD_TYPE: Release
182+
ENABLE_CUDA: ON
183+
CMAKE_CUDA_ARCHITECTURES: "86"
184+
NPROC: 4
185+
DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all"
186+
187+
- name: RHEL8.9-gcc13-cuda12-rel (ubi8.8, gcc 13.2.1, cuda-12.4.1, Release)
188+
DOCKER_REPOSITORY: geosx/ubi:8.9-cuda12.4.1
189+
RUNS_ON: streak2
190+
CMAKE_CXX_COMPILER: /opt/rh/gcc-toolset-13/root/bin/g++
191+
CMAKE_C_COMPILER: /opt/rh/gcc-toolset-13/root/bin/gcc
192+
CMAKE_BUILD_TYPE: Release
193+
ENABLE_CUDA: ON
194+
CMAKE_CUDA_ARCHITECTURES: "86"
195+
NPROC: 4
196+
DOCKER_RUN_ARGS: "--cpus=4 --memory=64g --runtime=nvidia --gpus all"
197+
198+
steps:
199+
- name: Checkout Repository
200+
uses: actions/[email protected]
201+
with:
202+
submodules: true
203+
lfs: false
204+
205+
- name: Print environment
206+
run: printenv
207+
208+
- name: Build and test
209+
env:
210+
DOCKER_REPOSITORY: ${{ matrix.DOCKER_REPOSITORY }}
211+
CMAKE_CXX_COMPILER: ${{ matrix.CMAKE_CXX_COMPILER }}
212+
CMAKE_C_COMPILER: ${{ matrix.CMAKE_C_COMPILER }}
213+
CMAKE_BUILD_TYPE: ${{ matrix.CMAKE_BUILD_TYPE }}
214+
ENABLE_CUDA: ${{ matrix.ENABLE_CUDA }}
215+
CMAKE_CUDA_ARCHITECTURES: ${{ matrix.CMAKE_CUDA_ARCHITECTURES }}
216+
NPROC: ${{ matrix.NPROC }}
217+
BUILD_AND_TEST_ARGS: ${{ matrix.BUILD_AND_TEST_ARGS }} --build-exe
218+
DOCKER_RUN_ARGS: ${{ matrix.DOCKER_RUN_ARGS }}
219+
HOST_CONFIG: hostconfigs/environment.cmake
220+
run: ./scripts/ci_build_and_test.sh
221+
222+
code_coverage:
223+
runs-on: ubuntu-22.04
224+
# needs:
225+
# - linux_builds
226+
steps:
227+
- name: Checkout Repository
228+
uses: actions/[email protected]
229+
with:
230+
submodules: true
231+
lfs: false
232+
- name: run code coverage
233+
env:
234+
DOCKER_REPOSITORY: geosx/ubuntu:22.04
235+
HOST_CONFIG: hostconfigs/environment.cmake
236+
CMAKE_CXX_COMPILER: /usr/bin/g++
237+
CMAKE_C_COMPILER: /usr/bin/gcc
238+
CMAKE_BUILD_TYPE: Debug
239+
BUILD_AND_TEST_ARGS: "--build-exe --code-coverage"
240+
run: ./scripts/ci_build_and_test.sh
241+
- name: Upload coverage reports to Codecov
242+
uses: codecov/codecov-action@v3
243+
with:
244+
files: shiva_coverage.info.cleaned
245+
fail_ci_if_error: true
246+
env:
247+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
248+
249+
250+
check_that_all_jobs_succeeded:
251+
runs-on: ubuntu-22.04
252+
needs:
253+
- linux_builds
254+
- doxygen_check
255+
- code_checks
256+
if: ${{ always() }}
257+
env:
258+
RETURN_VAL: |
259+
${{
260+
needs.linux_builds.result == 'success' &&
261+
needs.doxygen_check.result == 'success' &&
262+
needs.code_checks.result == 'success'
263+
}}
264+
steps:
265+
- name: PR Success
266+
if: ${{ contains(env.RETURN_VAL, 'true') }}
267+
run: "true"
268+
- name: PR Failure
269+
if: ${{ contains(env.RETURN_VAL, 'false') }}
270+
run: "false"

hostconfigs/environment.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
site_name(HOST_NAME)
2+
3+
set(CMAKE_C_COMPILER "$ENV{CC}" CACHE PATH "" FORCE)
4+
set(CMAKE_CXX_COMPILER "$ENV{CXX}" CACHE PATH "" FORCE)
5+
set(ENABLE_FORTRAN OFF CACHE BOOL "" FORCE)
6+
set(ENABLE_MPI OFF CACHE PATH "" FORCE)
7+
8+
set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "" FORCE)
9+
10+
set(ENABLE_CUDA "$ENV{ENABLE_CUDA}" CACHE BOOL "" FORCE)
11+
if(ENABLE_CUDA)
12+
set(CUDA_TOOLKIT_ROOT_DIR "$ENV{CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "" FORCE)
13+
if(NOT CUDA_TOOLKIT_ROOT_DIR)
14+
set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda" CACHE PATH "" FORCE)
15+
endif()
16+
17+
set(CMAKE_CUDA_ARCHITECTURES "$ENV{CMAKE_CUDA_ARCHITECTURES}" CACHE STRING "" FORCE)
18+
19+
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "")
20+
set(CMAKE_CUDA_COMPILER ${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc CACHE STRING "")
21+
set(CMAKE_CUDA_FLAGS "-restrict --expt-extended-lambda --expt-relaxed-constexpr -Werror cross-execution-space-call,reorder,deprecated-declarations" CACHE STRING "")
22+
23+
endif()

scripts/ci_build_and_test.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
env
3+
4+
BUILD_DIR=${GITHUB_WORKSPACE}
5+
BUILD_DIR_MOUNT_POINT=/tmp/HPCReact
6+
7+
8+
if [[ -z "${NPROC}" ]]; then
9+
NPROC=$(nproc)
10+
fi
11+
12+
# We need to keep track of the building container (hence the `CONTAINER_NAME`)
13+
# so we can extract the data from it later (if needed). Another solution would have been to use a mount point,
14+
# but that would not have solved the problem for the TPLs (we would require extra action to copy them to the mount point).
15+
CONTAINER_NAME=hpcreact_build
16+
17+
docker run \
18+
--rm \
19+
--volume=${BUILD_DIR}:${BUILD_DIR_MOUNT_POINT} \
20+
--cap-add=ALL \
21+
${DOCKER_RUN_ARGS} \
22+
-e HOST_CONFIG=${HOST_CONFIG} \
23+
-e CMAKE_C_COMPILER=${CMAKE_C_COMPILER} \
24+
-e CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} \
25+
-e CC=${CMAKE_C_COMPILER} \
26+
-e CXX=${CMAKE_CXX_COMPILER} \
27+
-e ENABLE_CUDA=${ENABLE_CUDA} \
28+
-e CMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES} \
29+
-e CMAKE_BUILD_TYPE \
30+
-e NPROC \
31+
${DOCKER_REPOSITORY} \
32+
${BUILD_DIR_MOUNT_POINT}/scripts/ci_build_and_test_in_container.sh ${BUILD_AND_TEST_ARGS};

0 commit comments

Comments
 (0)