-
Notifications
You must be signed in to change notification settings - Fork 55
197 lines (183 loc) · 7.64 KB
/
tests_cmake_testsuite.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
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
name: t8code CMake testsuite
# This file is part of t8code.
# t8code is a C library to manage a collection (a forest) of multiple
# connected adaptive space-trees of general element types in parallel.
#
# Copyright (C) 2024 the developers
#
# t8code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# t8code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with t8code; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# This github CI script installs t8code and runs its tests for various configurations.
# We compile sc and p4est as thirdparty libraries and use caching to only trigger a
# new installation of them when their versions have changed in t8code.
#
# Note: To manually enforce sc and p4est installation, either increase the counter
# in the "CACHE_COUNTER:" entries of the sc and p4est steps or set the variables
# IGNORE_CACHE to true in the respective steps.
on:
merge_group:
pull_request:
workflow_dispatch: # Be able to trigger this manually on github.com
# Run every night at 1:10
schedule:
- cron: '10 1 * * *'
# The CI pipeline should:
# - fully run in the merge queue with the full test suite
# - not run on draft PRs
# - run on draft PRs, if the latest commit message contains '[run ci]'
# - run on scheduled runs for the DLR-AMR/t8code repository
# - run on all other pull request events
# These conditions are checked in the fine_grained_trigger job. If it completes successfully, it triggers the preparation job,
# which triggers the actual tests.
# The job to build the tarball is only triggered on merge_group events for the DLR-AMR/t8code repository.
jobs:
fine_grained_trigger:
runs-on: ubuntu-latest
outputs:
run_ci: ${{ steps.set_run_ci.outputs.RUN_CI }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: set the run_ci variable for the testsute
id: set_run_ci
run: |
if [[ "${{ github.event_name }}" == "schedule" && "${{ github.repository }}" == "DLR-AMR/t8code" ]]; then
echo "Scheduled run for DLR-AMR/t8code, proceeding with CI."
echo "RUN_CI=true" >> $GITHUB_OUTPUT
exit 0
elif [[ "${{ github.event_name }}" == "merge_group" ]]; then
echo "Merge group event, proceeding with CI."
echo "RUN_CI=true" >> $GITHUB_OUTPUT
exit 0
fi
latest_commit_message=$(git log -1 --pretty=%B)
echo "Latest commit message: $latest_commit_message"
if [[ "${{ github.event_name }}" != "schedule" ]]; then
if [[ "${{ github.event.pull_request.draft }}" == "false" ]]; then
echo "Not a draft PR, proceeding with CI."
echo "RUN_CI=true" >> $GITHUB_OUTPUT
exit 0
elif [[ "${{ github.event.pull_request.draft }}" == "true" && "$latest_commit_message" == *"[run ci]"* ]]; then
echo "Draft PR with '[run ci]' in the latest commit message, proceeding with CI."
echo "RUN_CI=true" >> $GITHUB_OUTPUT
exit 0
else
echo "Draft PR without '[run ci]' in the latest commit message, skipping CI."
echo "RUN_CI=false" >> $GITHUB_OUTPUT
exit 0
fi
else
echo "Conditions not met, skipping CI."
echo "RUN_CI=false" >> $GITHUB_OUTPUT
exit 0
fi
# Preparation step for tests. Repo is cloned and sc + p4est are compiled with and without MPI.
preparation:
needs: [fine_grained_trigger]
secrets: inherit
if: needs.fine_grained_trigger.outputs.run_ci == 'true'
uses: ./.github/workflows/tests_cmake_preparation.yml
strategy:
fail-fast: false
matrix:
MPI: [OFF, ON]
include:
- MAKEFLAGS: -j4
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run
CACHE_COUNTER: 0 # Increase this number to force a new installation of sc and p4est and to update the cache once
MPI: ${{ matrix.MPI }}
# Run parallel tests for sc and p4est with and without MPI
sc_p4est_tests:
needs: preparation
uses: ./.github/workflows/tests_cmake_sc_p4est.yml
strategy:
fail-fast: false
matrix:
MPI: [OFF, ON]
include:
- MAKEFLAGS: -j4
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
MPI: ${{ matrix.MPI }}
# Run t8code tests with and without MPI and in serial and debug mode
t8code_tests:
needs: preparation
uses: ./.github/workflows/tests_cmake_t8code.yml
strategy:
fail-fast: false
matrix:
MPI: [OFF, ON]
BUILD_TYPE: [Debug, Release]
include:
- MAKEFLAGS: -j4
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
MPI: ${{ matrix.MPI }}
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
TEST_LEVEL: ${{ github.event_name == 'pull_request' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.
# Run t8code linkage tests with and without MPI and in serial and debug mode
t8code_linkage_tests:
needs: preparation
uses: ./.github/workflows/tests_cmake_t8code_linkage.yml
strategy:
fail-fast: false
matrix:
MPI: [OFF, ON]
BUILD_TYPE: [Debug, Release]
include:
- MAKEFLAGS: -j4
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
MPI: ${{ matrix.MPI }}
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
TEST_LEVEL: ${{ github.event_name == 'pull_request' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.
# Run t8code linkage tests with and without MPI and in serial and debug mode
t8code_api_tests:
needs: preparation
uses: ./.github/workflows/tests_cmake_t8code_api.yml
strategy:
fail-fast: false
matrix:
MPI: [ON] # For now the fortran API only supports building with MPI
BUILD_TYPE: [Debug, Release]
include:
- MAKEFLAGS: -j4
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
MPI: ${{ matrix.MPI }}
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
TEST_LEVEL: ${{ github.event_name == 'pull_request' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.
# Run t8code tests with shipped submodules. This test is only for the build system, so only one config is tested.
t8code_w_shipped_submodules_tests:
needs: fine_grained_trigger
secrets: inherit
if: ${{ needs.fine_grained_trigger.outputs.run_ci == 'true' }}
uses: ./.github/workflows/tests_cmake_t8code_w_shipped_submodules.yml
with:
MAKEFLAGS: -j4
MPI: ON
BUILD_TYPE: Debug
TEST_LEVEL: ${{ github.event_name == 'pull_request' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.
t8code_tarball:
if: github.event.pull_request.draft == false
uses: ./.github/workflows/build_cmake_tarball.yml
needs: [preparation, sc_p4est_tests, t8code_tests, t8code_linkage_tests, t8code_api_tests, t8code_w_shipped_submodules_tests]
with:
TEST_LEVEL: ${{ github.event_name == 'pull_request' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.