Skip to content

Commit 9d239b2

Browse files
committed
Update and merge with exemplar workflow
1 parent 097c505 commit 9d239b2

File tree

2 files changed

+153
-262
lines changed

2 files changed

+153
-262
lines changed

.github/workflows/ci_tests.yml

Lines changed: 123 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -4,253 +4,137 @@ name: Continuous Integration Tests
44

55
on:
66
push:
7+
branches:
8+
- main
79
pull_request:
810
workflow_dispatch:
911
schedule:
1012
- cron: '30 15 * * *'
1113

1214
jobs:
13-
beman-submodule-test:
14-
runs-on: ubuntu-latest
15-
name: "Check beman submodules for consistency"
16-
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v4
19-
- name: beman submodule consistency check
20-
run: |
21-
(set -o pipefail; ./infra/tools/beman-submodule/beman-submodule status | grep -qvF '+')
15+
beman-submodule-check:
16+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.1.0
2217

2318
preset-test:
24-
strategy:
25-
fail-fast: false
26-
matrix:
27-
presets:
28-
- preset: "gcc-debug"
29-
platform: "ubuntu-latest"
30-
- preset: "gcc-release"
31-
platform: "ubuntu-latest"
32-
- preset: "llvm-debug"
33-
platform: "ubuntu-latest"
34-
- preset: "llvm-release"
35-
platform: "ubuntu-latest"
36-
- preset: "appleclang-debug"
37-
platform: "macos-latest"
38-
- preset: "appleclang-release"
39-
platform: "macos-latest"
40-
- preset: "msvc-debug"
41-
platform: "windows-latest"
42-
- preset: "msvc-release"
43-
platform: "windows-latest"
44-
name: "Preset: ${{ matrix.presets.preset }} on ${{ matrix.presets.platform }}"
45-
runs-on: ${{ matrix.presets.platform }}
46-
steps:
47-
- uses: actions/checkout@v4
48-
- name: Setup build environment
49-
uses: lukka/get-cmake@latest
50-
with:
51-
cmakeVersion: "~3.25.0"
52-
ninjaVersion: "^1.11.1"
53-
- name: Setup MSVC
54-
if: startsWith(matrix.presets.platform, 'windows')
55-
uses: TheMrMilchmann/setup-msvc-dev@v3
56-
with:
57-
arch: x64
58-
- name: Run preset
59-
run: cmake --workflow --preset ${{ matrix.presets.preset }}
60-
61-
gtest-test:
62-
strategy:
63-
fail-fast: false
64-
matrix:
65-
platform:
66-
- description: "Ubuntu GNU"
67-
os: ubuntu-latest
68-
toolchain: "infra/cmake/gnu-toolchain.cmake"
69-
- description: "Ubuntu LLVM"
70-
os: ubuntu-latest
71-
toolchain: "infra/cmake/llvm-toolchain.cmake"
72-
- description: "Windows MSVC"
73-
os: windows-latest
74-
toolchain: "infra/cmake/msvc-toolchain.cmake"
75-
- description: "Macos Appleclang"
76-
os: macos-latest
77-
toolchain: "infra/cmake/appleclang-toolchain.cmake"
78-
cpp_version: [17, 20, 23, 26]
79-
cmake_args:
80-
- description: "Default"
81-
- description: "TSan"
82-
args: "-DBEMAN_BUILDSYS_SANITIZER=TSan"
83-
- description: "MaxSan"
84-
args: "-DBEMAN_BUILDSYS_SANITIZER=MaxSan"
85-
include:
86-
- platform:
87-
description: "Ubuntu GCC"
88-
os: ubuntu-latest
89-
toolchain: "infra/cmake/gnu-toolchain.cmake"
90-
cpp_version: 17
91-
cmake_args:
92-
description: "Werror"
93-
args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"
94-
- platform:
95-
description: "Ubuntu GCC"
96-
os: ubuntu-latest
97-
toolchain: "infra/cmake/gnu-toolchain.cmake"
98-
cpp_version: 17
99-
cmake_args:
100-
description: "Dynamic"
101-
args: "-DBUILD_SHARED_LIBS=on"
102-
exclude:
103-
# MSVC does not support thread sanitizer
104-
- platform:
105-
description: "Windows MSVC"
106-
cmake_args:
107-
description: "TSan"
108-
109-
name: "Unit:
110-
${{ matrix.platform.description }}
111-
${{ matrix.cpp_version }}
112-
${{ matrix.cmake_args.description }}"
113-
runs-on: ${{ matrix.platform.os }}
114-
steps:
115-
- uses: actions/checkout@v4
116-
- name: Install Ninja
117-
uses: lukka/get-cmake@latest
118-
with:
119-
cmakeVersion: "~3.25.0"
120-
ninjaVersion: "^1.11.1"
121-
- name: Setup MSVC
122-
if: startsWith(matrix.platform.os, 'windows')
123-
uses: TheMrMilchmann/setup-msvc-dev@v3
124-
with:
125-
arch: x64
126-
- name: Build and Test
127-
uses: ./.github/actions/cmake-build-test
128-
with:
129-
cpp_version: ${{ matrix.cpp_version }}
130-
toolchain_file: ${{ matrix.platform.toolchain }}
131-
cmake_extra_args: ${{ matrix.cmake_args.args }}
132-
133-
configuration-test:
134-
runs-on: ubuntu-latest
135-
strategy:
136-
fail-fast: false
137-
matrix:
138-
args:
139-
- name: "Disable build testing"
140-
arg: "-DBEMAN_CSTRING_VIEW_BUILD_TESTS=OFF"
141-
- name: "Disable example building"
142-
arg: "-DBEMAN_CSTRING_VIEW_BUILD_EXAMPLES=OFF"
143-
- name: "Disable config-file package creation"
144-
arg: "-DBEMAN_CSTRING_VIEW_INSTALL_CONFIG_FILE_PACKAGE=OFF"
145-
name: "CMake: ${{ matrix.args.name }}"
146-
steps:
147-
- uses: actions/checkout@v4
148-
- name: Setup build environment
149-
uses: lukka/get-cmake@latest
150-
with:
151-
cmakeVersion: "~3.25.0"
152-
ninjaVersion: "^1.11.1"
153-
- name: Build and Test
154-
uses: ./.github/actions/cmake-build-test
155-
with:
156-
cpp_version: 17
157-
toolchain_file: "infra/cmake/gnu-toolchain.cmake"
158-
cmake_extra_args: ${{ matrix.args.arg }}
159-
disable_test: true
160-
161-
compiler-test:
162-
runs-on: ubuntu-24.04
163-
strategy:
164-
fail-fast: false
165-
matrix:
166-
compilers:
167-
- class: GNU
168-
version: 14
169-
toolchain: "infra/cmake/gnu-toolchain.cmake"
170-
- class: GNU
171-
version: 13
172-
toolchain: "infra/cmake/gnu-toolchain.cmake"
173-
- class: GNU
174-
version: 12
175-
toolchain: "infra/cmake/gnu-toolchain.cmake"
176-
- class: LLVM
177-
version: 20
178-
toolchain: "infra/cmake/llvm-toolchain.cmake"
179-
- class: LLVM
180-
version: 19
181-
toolchain: "infra/cmake/llvm-toolchain.cmake"
182-
- class: LLVM
183-
version: 18
184-
toolchain: "infra/cmake/llvm-toolchain.cmake"
185-
- class: LLVM
186-
version: 17
187-
toolchain: "infra/cmake/llvm-toolchain.cmake"
188-
name: "Compiler: ${{ matrix.compilers.class }} ${{ matrix.compilers.version }}"
189-
steps:
190-
- uses: actions/checkout@v4
191-
- name: Setup build environment
192-
uses: lukka/get-cmake@latest
193-
with:
194-
cmakeVersion: "~3.25.0"
195-
ninjaVersion: "^1.11.1"
196-
- name: Install Compiler
197-
id: install-compiler
198-
run: |
199-
sudo add-apt-repository universe
200-
sudo apt-get update
201-
202-
if [ "${{ matrix.compilers.class }}" = "GNU" ]; then
203-
CC=gcc-${{ matrix.compilers.version }}
204-
CXX=g++-${{ matrix.compilers.version }}
205-
206-
sudo apt-get install -y $CC
207-
sudo apt-get install -y $CXX
208-
209-
$CC --version
210-
$CXX --version
211-
else
212-
wget https://apt.llvm.org/llvm.sh
213-
chmod +x llvm.sh
214-
sudo bash llvm.sh ${{ matrix.compilers.version }}
215-
216-
CC=clang-${{ matrix.compilers.version }}
217-
CXX=clang++-${{ matrix.compilers.version }}
218-
219-
$CC --version
220-
$CXX --version
221-
fi
222-
223-
echo "CC=$CC" >> "$GITHUB_OUTPUT"
224-
echo "CXX=$CXX" >> "$GITHUB_OUTPUT"
225-
- name: Build and Test
226-
uses: ./.github/actions/cmake-build-test
227-
with:
228-
cpp_version: 20
229-
toolchain_file: ${{ matrix.compilers.toolchain }}
19+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.1.0
20+
with:
21+
matrix_config: >
22+
[
23+
{"preset": "gcc-debug", "image": "ghcr.io/bemanproject/infra-containers-gcc:latest"},
24+
{"preset": "gcc-release", "image": "ghcr.io/bemanproject/infra-containers-gcc:latest"},
25+
{"preset": "llvm-debug", "image": "ghcr.io/bemanproject/infra-containers-clang:latest"},
26+
{"preset": "llvm-release", "image": "ghcr.io/bemanproject/infra-containers-clang:latest"},
27+
{"preset": "appleclang-debug", "runner": "macos-latest"},
28+
{"preset": "appleclang-release", "runner": "macos-latest"},
29+
{"preset": "msvc-debug", "runner": "windows-latest"},
30+
{"preset": "msvc-release", "runner": "windows-latest"}
31+
]
32+
33+
build-and-test:
34+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.1.0
35+
with:
36+
matrix_config: >
37+
{
38+
"gcc": [
39+
{ "versions": ["15"],
40+
"tests": [
41+
{ "cxxversions": ["c++26"],
42+
"tests": [
43+
{ "stdlibs": ["libstdc++"],
44+
"tests": [
45+
"Debug.Default", "Release.Default", "Release.TSan",
46+
"Release.MaxSan", "Debug.Werror", "Debug.Dynamic",
47+
"Debug.Coverage"
48+
]
49+
}
50+
]
51+
},
52+
{ "cxxversions": ["c++23", "c++20", "c++17"],
53+
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
54+
}
55+
]
56+
},
57+
{ "versions": ["14", "13"],
58+
"tests": [
59+
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
60+
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
61+
}
62+
]
63+
},
64+
{
65+
"versions": ["12", "11"],
66+
"tests": [
67+
{ "cxxversions": ["c++23", "c++20", "c++17"],
68+
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
69+
}
70+
]
71+
}
72+
],
73+
"clang": [
74+
{ "versions": ["21"],
75+
"tests": [
76+
{"cxxversions": ["c++26"],
77+
"tests": [
78+
{ "stdlibs": ["libstdc++", "libc++"],
79+
"tests": [
80+
"Debug.Default", "Release.Default", "Release.TSan",
81+
"Release.MaxSan", "Debug.Werror", "Debug.Dynamic"
82+
]
83+
}
84+
]
85+
},
86+
{ "cxxversions": ["c++23", "c++20", "c++17"],
87+
"tests": [
88+
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
89+
]
90+
}
91+
]
92+
},
93+
{ "versions": ["20", "19", "18"],
94+
"tests": [
95+
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
96+
"tests": [
97+
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
98+
]
99+
}
100+
]
101+
},
102+
{ "versions": ["17"],
103+
"tests": [
104+
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
105+
"tests": [{"stdlibs": ["libc++"], "tests": ["Release.Default"]}]
106+
},
107+
{ "cxxversions": ["c++20", "c++17"],
108+
"tests": [{"stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
109+
}
110+
]
111+
}
112+
],
113+
"appleclang": [
114+
{ "versions": ["latest"],
115+
"tests": [
116+
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
117+
"tests": [{ "stdlibs": ["libc++"], "tests": ["Release.Default"]}]
118+
}
119+
]
120+
}
121+
],
122+
"msvc": [
123+
{ "versions": ["latest"],
124+
"tests": [
125+
{ "cxxversions": ["c++23"],
126+
"tests": [
127+
{ "stdlibs": ["stl"],
128+
"tests": ["Debug.Default", "Release.Default", "Release.MaxSan"]
129+
}
130+
]
131+
}
132+
]
133+
}
134+
]
135+
}
230136
231137
create-issue-when-fault:
232-
runs-on: ubuntu-latest
233-
needs: [preset-test, gtest-test, configuration-test, compiler-test]
138+
needs: [preset-test, build-and-test]
234139
if: failure() && github.event_name == 'schedule'
235-
steps:
236-
# See https://github.com/cli/cli/issues/5075
237-
- uses: actions/checkout@v4
238-
- name: Create issue
239-
run: |
240-
issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] Build & Test failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end')
241-
242-
body="**Build-and-Test Failure Report**
243-
- **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z')
244-
- **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
245-
- **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
246-
247-
The scheduled build-and-test triggered by cron has failed.
248-
Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error."
249-
250-
if [[ $issue_num -eq -1 ]]; then
251-
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body"
252-
else
253-
gh issue comment --repo ${{ github.repository }} $issue_num --body "$body"
254-
fi
255-
env:
256-
GH_TOKEN: ${{ github.token }}
140+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.1.0

0 commit comments

Comments
 (0)