-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (86 loc) · 2.89 KB
/
ci.yml
File metadata and controls
99 lines (86 loc) · 2.89 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
name: CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
permissions:
checks: write
contents: read
env:
CMAKE_VERSION: '3.31.7'
CMAKE_INSTALL_DIR: '${{ github.workspace }}/.cmake'
CMAKE_BIN: '${{ github.workspace }}/.cmake/bin/cmake'
TEST_RESULTS_DIR: '${{ github.workspace }}/test-results'
jobs:
build-and-test:
strategy:
matrix:
include:
- name: Ubuntu-22.04-GCC
os: ubuntu-22.04
cc: gcc
cxx: g++
- name: Ubuntu-22.04-Clang
os: ubuntu-22.04
cc: clang
cxx: clang++
- name: Ubuntu-24.04-GCC
os: ubuntu-24.04
cc: gcc
cxx: g++
- name: Ubuntu-24.04-Clang
os: ubuntu-24.04
cc: clang
cxx: clang++
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y ninja-build gcc g++ clang ${{ matrix.extra_packages }}
- name: Cache CMake
uses: actions/cache@v4
with:
path: ${{ env.CMAKE_INSTALL_DIR }}
key: cmake-${{ env.CMAKE_VERSION }}-${{ matrix.os }}-${{ matrix.cc }}-try2
- name: Download and Install CMake if not cached
run: |
if [ ! -f "${{ env.CMAKE_BIN }}" ]; then
echo "CMake not found in cache. Downloading..."
mkdir -p "${{ env.CMAKE_INSTALL_DIR }}"
wget -q https://github.com/Kitware/CMake/releases/download/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION }}-linux-x86_64.tar.gz
tar -xzf cmake-${{ env.CMAKE_VERSION }}-linux-x86_64.tar.gz --strip-components=1 -C "${{ env.CMAKE_INSTALL_DIR }}"
else
echo "Using cached CMake"
fi
"${{ env.CMAKE_BIN }}" --version
- name: Run CMake configuration and build
run: |
"${{ env.CMAKE_BIN }}" examples -B build -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
"${{ env.CMAKE_BIN }}" --build build --parallel
- name: Run Unit Tests
run: |
mkdir -p "${{ env.TEST_RESULTS_DIR }}"
./build/tests --reporters=junit --out="${{ env.TEST_RESULTS_DIR }}/results.xml"
- name: Render JUnit results in GitHub UI
if: always()
uses: dorny/test-reporter@v1.6.0
with:
name: ${{ matrix.name }} Tests
path: ${{ env.TEST_RESULTS_DIR }}/results.xml
reporter: java-junit
- name: Upload Test Results Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-test-results
path: ${{ env.TEST_RESULTS_DIR }}/results.xml