Repository navigation
202 lines (189 loc) · 7.33 KB
/
Copy pathci-tests.yml
File metadata and controls
202 lines (189 loc) · 7.33 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
191
192
193
194
195
196
197
198
199
200
201
202
name: CI Tests
on:
pull_request:
push:
branches:
- develop
# Cancel previous jobs if an update has been made to the pull request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }}
permissions:
contents: read
env:
CLANG_DOCKER_IMAGE: seracllnl/tpls:clang-19_09-04-26_01h-36m
CUDA_DOCKER_IMAGE: seracllnl/tpls:cuda-12_01-09-26_02h-37m
GCC_DOCKER_IMAGE: seracllnl/tpls:gcc-14_09-04-26_01h-30m
jobs:
# Hacky solution to reference env variables outside of `run` steps https://stackoverflow.com/a/74217028
set_image_vars:
runs-on: ubuntu-latest
steps:
- name: Do Nothing
run: echo
outputs:
clang_docker_image: ${{ env.CLANG_DOCKER_IMAGE }}
cuda_docker_image: ${{ env.CUDA_DOCKER_IMAGE }}
gcc_docker_image: ${{ env.GCC_DOCKER_IMAGE }}
build_and_test:
runs-on: ubuntu-24.04
needs:
- set_image_vars
strategy:
fail-fast: true
matrix:
build_type: [ Debug, Release ]
config:
- job_name: llvm@19.1.1, shared
host_config: llvm@19.1.1.cmake
compiler_image: ${{ needs.set_image_vars.outputs.clang_docker_image }}
cmake_opts: "-DBUILD_SHARED_LIBS=ON -DENABLE_DOCS=OFF"
# # Not enough disk space to run CUDA container
# https://github.com/LLNL/smith/issues/1479
# - job_name: gcc@13.3.0, shared, cuda, no tests/install/warnings as errors
# host_config: gcc@13.3.0_cuda.cmake
# compiler_image: ${{ needs.set_image_vars.outputs.cuda_docker_image }}
# cmake_opts: "-DBUILD_SHARED_LIBS=ON -DENABLE_DOCS=OFF -DENABLE_WARNINGS_AS_ERRORS=OFF"
# build_src_opts: "--skip-install --skip-tests"
- job_name: gcc@14.2.0, shared
host_config: gcc@14.2.0.cmake
compiler_image: ${{ needs.set_image_vars.outputs.gcc_docker_image }}
cmake_opts: "-DBUILD_SHARED_LIBS=ON -DENABLE_DOCS=OFF"
include:
- build_type: Debug
config:
job_name: llvm@19.1.1, shared, codevelop
host_config: llvm@19.1.1.cmake
compiler_image: ${{ needs.set_image_vars.outputs.clang_docker_image }}
cmake_opts: "-DBUILD_SHARED_LIBS=ON -DENABLE_DOCS=OFF -DSMITH_ENABLE_CODEVELOP=ON"
build_src_opts: "--skip-install"
name: ${{ matrix.build_type }} - ${{ matrix.config.job_name }}
container:
image: ${{ matrix.config.compiler_image }}
volumes:
- /home/smith/smith
# Required - default is set to user "smith"
options: --user root
steps:
- name: Checkout Smith
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: recursive
persist-credentials: false
- name: Print Matrix Variables
run: |
echo "build_src_opts ${{ matrix.config.build_src_opts }}"
echo "build_type ${{ matrix.build_type }}"
echo "cmake_opts ${{ matrix.config.cmake_opts }}"
echo "compiler_image ${{ matrix.config.compiler_image }}"
echo "host_config ${{ matrix.config.host_config }}"
- name: Build and Test ${{ matrix.config.host_config }} ${{ matrix.build_type }}
timeout-minutes: 60
run: |
./scripts/llnl/build_src.py ${{ matrix.config.build_src_opts }} \
--verbose \
--host-config ${{ matrix.config.host_config }} \
--extra-cmake-options "${{ matrix.config.cmake_opts }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}" \
--jobs 4
- name: Upload Test Results
# CUDA containers do not run tests, because runners don't have GPUs, so skip upload in that case
if: ${{ matrix.config.compiler_image != needs.set_image_vars.outputs.cuda_docker_image }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: Test Results ${{ matrix.config.host_config }} ${{ matrix.build_type }} ${{ matrix.config.cmake_opts }}
path: "**/Test.xml"
check_code:
runs-on: ubuntu-24.04
needs:
- set_image_vars
container:
image: ${{ needs.set_image_vars.outputs.clang_docker_image }}
volumes:
- /home/smith/smith
# Required - default is set to user "smith"
options: --user root
env:
HOST_CONFIG: llvm@19.1.1.cmake
steps:
- name: Checkout Smith
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: recursive
persist-credentials: false
- name: Configure, build, and install
id: setup
shell: bash
env:
CHECK_TYPE: setup
run: |
mkdir -p code-quality-logs
./scripts/github-actions/linux-check.sh 2>&1 | tee code-quality-logs/setup.log
# Let every check run, then report their combined result below.
- name: Check style
id: style
continue-on-error: true
shell: bash
env:
CHECK_TYPE: style
run: ./scripts/github-actions/linux-check.sh 2>&1 | tee code-quality-logs/style.log
- name: Check headers
id: header
continue-on-error: true
shell: bash
env:
CHECK_TYPE: header
run: ./scripts/github-actions/linux-check.sh 2>&1 | tee code-quality-logs/header.log
- name: Check docs
id: docs
continue-on-error: true
shell: bash
env:
CHECK_TYPE: docs
run: ./scripts/github-actions/linux-check.sh 2>&1 | tee code-quality-logs/docs.log
- name: Upload code quality logs
if: ${{ always() }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: Code quality logs
path: code-quality-logs
if-no-files-found: warn
- name: Report code quality results
if: ${{ always() }}
shell: bash
env:
SETUP_RESULT: ${{ steps.setup.outcome }}
STYLE_RESULT: ${{ steps.style.outcome }}
HEADER_RESULT: ${{ steps.header.outcome }}
DOCS_RESULT: ${{ steps.docs.outcome }}
run: |
show_failed_log() {
local check_name="$1"
local result="$2"
local log_file="code-quality-logs/${check_name}.log"
if [[ "$result" != "failure" || ! -f "$log_file" ]]; then
return
fi
echo "::group::Last 200 lines from the ${check_name} log"
tail -n 200 "$log_file"
echo "::endgroup::"
}
if [[ "$SETUP_RESULT" != "success" ]]; then
echo "::error::Code quality setup failed; style, header, and docs checks could not run."
show_failed_log setup "$SETUP_RESULT"
echo "Download the 'Code quality logs' artifact for the complete setup log."
exit 1
fi
failed_checks=()
[[ "$STYLE_RESULT" == "success" ]] || failed_checks+=(style)
[[ "$HEADER_RESULT" == "success" ]] || failed_checks+=(header)
[[ "$DOCS_RESULT" == "success" ]] || failed_checks+=(docs)
if (( ${#failed_checks[@]} == 0 )); then
echo "All code quality checks passed."
exit 0
fi
echo "::error::Code quality checks failed: ${failed_checks[*]}"
show_failed_log style "$STYLE_RESULT"
show_failed_log header "$HEADER_RESULT"
show_failed_log docs "$DOCS_RESULT"
echo "Download the 'Code quality logs' artifact for the complete logs."
exit 1