Skip to content

Commit 15f18ad

Browse files
author
pfeatherstone
committed
CI workflow - don't use matrix otherwise you don't get different badges
1 parent e04fdde commit 15f18ad

File tree

1 file changed

+61
-72
lines changed

1 file changed

+61
-72
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,92 +8,81 @@ on:
88
branches:
99
- '**'
1010

11-
permissions:
12-
checks: write
13-
contents: read
14-
15-
env:
16-
CMAKE_VERSION: '3.31.7'
17-
CMAKE_INSTALL_DIR: '${{ github.workspace }}/.cmake'
18-
CMAKE_BIN: '${{ github.workspace }}/.cmake/bin/cmake'
19-
TEST_RESULTS_DIR: '${{ github.workspace }}/test-results'
20-
2111
jobs:
22-
build-and-test:
23-
strategy:
24-
matrix:
25-
include:
26-
- name: Ubuntu-22.04-GCC
27-
os: ubuntu-22.04
28-
cc: gcc
29-
cxx: g++
30-
- name: Ubuntu-22.04-Clang
31-
os: ubuntu-22.04
32-
cc: clang
33-
cxx: clang++
34-
- name: Ubuntu-24.04-GCC
35-
os: ubuntu-24.04
36-
cc: gcc
37-
cxx: g++
38-
- name: Ubuntu-24.04-Clang
39-
os: ubuntu-24.04
40-
cc: clang
41-
cxx: clang++
42-
43-
runs-on: ${{ matrix.os }}
44-
name: ${{ matrix.name }}
12+
ubuntu-22-gcc:
13+
runs-on: ubuntu-22.04
14+
name: Ubuntu-22.04-GCC
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install dependencies
20+
run: sudo apt update && sudo apt install -y ninja-build gcc g++ cmake
21+
22+
- name: Run CMake configuration and build
23+
run: |
24+
cmake examples -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
25+
cmake --build build --parallel
26+
27+
- name: Run Unit Tests
28+
run: ./build/tests
4529

30+
ubuntu-22-clang:
31+
runs-on: ubuntu-22.04
32+
name: Ubuntu-22.04-Clang
4633
steps:
4734
- name: Checkout repository
4835
uses: actions/checkout@v4
4936

5037
- name: Install dependencies
38+
run: sudo apt update && sudo apt install -y ninja-build clang cmake
39+
40+
- name: Run CMake configuration and build
5141
run: |
52-
sudo apt update
53-
sudo apt install -y ninja-build gcc g++ clang ${{ matrix.extra_packages }}
42+
cmake examples -B build -G Ninja \
43+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
44+
-DCMAKE_C_COMPILER=clang \
45+
-DCMAKE_CXX_COMPILER=clang++
46+
cmake --build build --parallel
5447
55-
- name: Cache CMake
56-
uses: actions/cache@v4
57-
with:
58-
path: ${{ env.CMAKE_INSTALL_DIR }}
59-
key: cmake-${{ env.CMAKE_VERSION }}-${{ matrix.os }}-${{ matrix.cc }}-try2
48+
- name: Run Unit Tests
49+
run: ./build/tests
6050

61-
- name: Download and Install CMake if not cached
51+
ubuntu-24-gcc:
52+
runs-on: ubuntu-24.04
53+
name: Ubuntu-24.04-GCC
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v4
57+
58+
- name: Install dependencies
59+
run: sudo apt update && sudo apt install -y ninja-build gcc g++ cmake
60+
61+
- name: Run CMake configuration and build
6262
run: |
63-
if [ ! -f "${{ env.CMAKE_BIN }}" ]; then
64-
echo "CMake not found in cache. Downloading..."
65-
mkdir -p "${{ env.CMAKE_INSTALL_DIR }}"
66-
wget -q https://github.com/Kitware/CMake/releases/download/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION }}-linux-x86_64.tar.gz
67-
tar -xzf cmake-${{ env.CMAKE_VERSION }}-linux-x86_64.tar.gz --strip-components=1 -C "${{ env.CMAKE_INSTALL_DIR }}"
68-
else
69-
echo "Using cached CMake"
70-
fi
71-
"${{ env.CMAKE_BIN }}" --version
63+
cmake examples -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
64+
cmake --build build --parallel
65+
66+
- name: Run Unit Tests
67+
run: ./build/tests
68+
69+
ubuntu-24-clang:
70+
runs-on: ubuntu-24.04
71+
name: Ubuntu-24.04-Clang
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
76+
- name: Install dependencies
77+
run: sudo apt update && sudo apt install -y ninja-build clang cmake
7278

7379
- name: Run CMake configuration and build
7480
run: |
75-
"${{ env.CMAKE_BIN }}" examples -B build -G Ninja \
81+
cmake examples -B build -G Ninja \
7682
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
77-
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
78-
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
79-
"${{ env.CMAKE_BIN }}" --build build --parallel
83+
-DCMAKE_C_COMPILER=clang \
84+
-DCMAKE_CXX_COMPILER=clang++
85+
cmake --build build --parallel
8086
8187
- name: Run Unit Tests
82-
run: |
83-
mkdir -p "${{ env.TEST_RESULTS_DIR }}"
84-
./build/tests --reporters=junit --out="${{ env.TEST_RESULTS_DIR }}/results.xml"
85-
86-
- name: Render JUnit results in GitHub UI
87-
if: always()
88-
uses: dorny/[email protected]
89-
with:
90-
name: ${{ matrix.name }} Tests
91-
path: ${{ env.TEST_RESULTS_DIR }}/results.xml
92-
reporter: java-junit
93-
94-
- name: Upload Test Results Artifact
95-
if: always()
96-
uses: actions/upload-artifact@v4
97-
with:
98-
name: ${{ matrix.name }}-test-results
99-
path: ${{ env.TEST_RESULTS_DIR }}/results.xml
88+
run: ./build/tests

0 commit comments

Comments
 (0)