Skip to content

Commit 45eafb9

Browse files
committed
ci/cd: testing (part 2)
1 parent 70e8356 commit 45eafb9

File tree

1 file changed

+48
-29
lines changed

1 file changed

+48
-29
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,64 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: [ ubuntu-latest, macos-latest, windows-latest ]
16+
include:
17+
- name: "Linux (Clang)"
18+
runner: ubuntu-latest
19+
c_compiler: clang
20+
cxx_compiler: clang++
21+
toolchain_file: ""
22+
artifact_name: examples-linux-clang
1723

18-
runs-on: ${{ matrix.os }}
24+
- name: "macOS (Clang)"
25+
runner: macos-latest
26+
c_compiler: clang
27+
cxx_compiler: clang++
28+
toolchain_file: ""
29+
artifact_name: examples-macos-clang
30+
31+
- name: "Windows (MinGW Cross-Compile)"
32+
runner: ubuntu-latest
33+
c_compiler: x86_64-w64-mingw32-gcc
34+
cxx_compiler: x86_64-w64-mingw32-g++
35+
toolchain_file: "windows-mingw-toolchain.cmake"
36+
artifact_name: examples-windows-mingw
37+
38+
runs-on: ${{ matrix.runner }}
1939

2040
steps:
2141
- name: Checkout repository
2242
uses: actions/checkout@v4
2343

24-
- name: Set up MSYS2 (for MinGW on Windows)
25-
if: matrix.os == 'windows-latest'
26-
uses: msys2/setup-msys2@v2
27-
with:
28-
msystem: MINGW64
29-
update: true
30-
install: >-
31-
git
32-
mingw-w64-x86_64-toolchain
33-
mingw-w64-x86_64-cmake
34-
35-
- name: Configure CMake (Windows)
36-
if: matrix.os == 'windows-latest'
37-
shell: msys2 {0}
38-
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON
39-
40-
- name: Configure CMake (Linux/macOS)
41-
if: matrix.os != 'windows-latest'
42-
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON
43-
44-
- name: Build with CMake (Windows)
45-
if: matrix.os == 'windows-latest'
46-
shell: msys2 {0}
47-
run: cmake --build build --config Release --parallel
44+
- name: Install Dependencies
45+
run: |
46+
if [ "${{ matrix.runner }}" == "ubuntu-latest" ]; then
47+
sudo apt-get update
48+
if [ "${{ matrix.name }}" == "Linux (Clang)" ]; then
49+
sudo apt-get install -y clang
50+
elif [ "${{ matrix.name }}" == "Windows (MinGW Cross-Compile)" ]; then
51+
sudo apt-get install -y mingw-w64
52+
fi
53+
fi
54+
55+
- name: Configure CMake
56+
run: |
57+
TOOLCHAIN_ARGS=""
58+
if [ -n "${{ matrix.toolchain_file }}" ]; then
59+
TOOLCHAIN_ARGS="-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_file }}"
60+
fi
61+
62+
cmake -B build -S . \
63+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
64+
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} \
65+
-DCMAKE_BUILD_TYPE=Release \
66+
-DBUILD_EXAMPLES=ON \
67+
$TOOLCHAIN_ARGS
4868
49-
- name: Build with CMake (Linux/macOS)
50-
if: matrix.os != 'windows-latest'
69+
- name: Build with CMake
5170
run: cmake --build build --config Release --parallel
5271

5372
- name: Archive examples
5473
uses: actions/upload-artifact@v4
5574
with:
56-
name: examples-${{ matrix.os }}
75+
name: ${{ matrix.artifact_name }}
5776
path: build/bin/

0 commit comments

Comments
 (0)