-
Notifications
You must be signed in to change notification settings - Fork 18
142 lines (133 loc) · 4.99 KB
/
ci_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
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Continuous Integration Tests
on:
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: '30 15 * * *'
jobs:
preset-test:
runs-on: ubuntu-latest
strategy:
matrix:
preset: ["gcc-debug", "gcc-release"]
steps:
- uses: actions/checkout@v4
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.25.x'
- uses: seanmiddleditch/gha-setup-ninja@v5
- name: Run preset
run: cmake --workflow --preset ${{ matrix.preset }}
test:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
compiler:
- cpp: g++
c: gcc
- cpp: clang++
c: clang
cmake_args:
- description: "Static default"
args: ""
- description: "Dynamic default"
args: "-DBUILD_SHARED_LIBS=on"
- description: "static C++17"
args: "-DCMAKE_CXX_STANDARD=17"
- description: "static C++20"
args: "-DCMAKE_CXX_STANDARD=20"
- description: "static C++23"
args: "-DCMAKE_CXX_STANDARD=23"
- description: "static C++26"
args: "-DCMAKE_CXX_STANDARD=26"
include:
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cmake_args:
description: "Werror"
cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cmake_args:
description: "A-San"
cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=address -fsanitize=undefined"
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cmake_args:
description: "T-San"
cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread"
name: "Bulid & Test: ${{ matrix.compiler.c }} ${{ matrix.cmake_args.description }}"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Print installed softwares
run: |
clang++ --version
g++ --version
cmake --version
ninja --version
- name: Build Release
run: |
cmake -B build -S . "${{ matrix.cmake_args.args }}"
cmake --build build --config Release --verbose
cmake --build build --config Release --target all_verify_interface_header_sets
cmake --install build --config Release --prefix /opt/beman.exemplar
find /opt/beman.exemplar -type f
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
CMAKE_GENERATOR: "Ninja Multi-Config"
- name: Test Release
run: ctest --test-dir build --build-config Release
- name: Build Debug
run: |
cmake -B build -S . "${{ matrix.cmake_args.args }}"
cmake --build build --config Debug --verbose
cmake --build build --config Debug --target all_verify_interface_header_sets
cmake --install build --config Debug --prefix /opt/beman.exemplar
find /opt/beman.exemplar -type f
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
CMAKE_GENERATOR: "Ninja Multi-Config"
- name: Test Release
run: ctest --test-dir build --build-config Debug
create-issue-when-fault:
runs-on: ubuntu-latest
needs: [preset-test, test]
if: failure() && github.event_name == 'schedule'
steps:
# See https://github.com/cli/cli/issues/5075
- uses: actions/checkout@v4
- name: Create issue
run: |
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')
body="**Build-and-Test Failure Report**
- **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z')
- **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
- **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
The scheduled build-and-test triggered by cron has failed.
Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error."
if [[ $issue_num -eq -1 ]]; then
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body"
else
gh issue comment --repo ${{ github.repository }} $issue_num --body "$body"
fi
env:
GH_TOKEN: ${{ github.token }}