Skip to content

Commit cc34f66

Browse files
authored
Update main.yml
1 parent e66a454 commit cc34f66

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

.github/workflows/main.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,40 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
compiler: [g++, clang++]
15+
build_type: [Debug, Release]
16+
env:
17+
BUILD_DIR: build
18+
CMAKE_FLAGS: -GNinja -DENABLE_TESTING=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
1219

1320
steps:
1421
- name: Checkout code
15-
uses: actions/checkout@v4
22+
uses: actions/checkout@v4.0.0
1623

1724
- name: Install dependencies
18-
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build g++ libgtest-dev
25+
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build ${{ matrix.compiler }} libgtest-dev
26+
27+
- name: Cache build
28+
uses: actions/cache@v3
29+
with:
30+
path: ${{ env.BUILD_DIR }}
31+
key: ${{ runner.os }}-build-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
32+
restore-keys: |
33+
${{ runner.os }}-build-${{ matrix.compiler }}-
1934
2035
- name: Configure CMake
21-
run: cmake -S . -B build -GNinja -DENABLE_TESTING=ON
36+
run: cmake -S . -B ${{ env.BUILD_DIR }} ${{ env.CMAKE_FLAGS }}
2237

2338
- name: Build
24-
run: cmake --build build
39+
run: cmake --build ${{ env.BUILD_DIR }}
2540

2641
- name: Run tests
27-
run: ctest --test-dir build --output-on-failure
42+
run: ctest --test-dir ${{ env.BUILD_DIR }} --output-on-failure
43+
44+
- name: Upload Build Artifacts
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: build-artifacts-${{ matrix.compiler }}-${{ matrix.build_type }}
48+
path: ${{ env.BUILD_DIR }}

0 commit comments

Comments
 (0)