Skip to content

Commit e204e56

Browse files
authored
Add build workflow
1 parent 36cf8a2 commit e204e56

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/build.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
13+
strategy:
14+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
15+
fail-fast: false
16+
17+
matrix:
18+
os: [ubuntu-latest, windows-latest]
19+
build_type: [Release]
20+
c_compiler: [gcc, clang, cl]
21+
include:
22+
- os: windows-latest
23+
c_compiler: cl
24+
cpp_compiler: cl
25+
- os: windows-latest
26+
c_compiler: gcc
27+
cpp_compiler: g++
28+
- os: ubuntu-latest
29+
c_compiler: gcc
30+
cpp_compiler: g++
31+
- os: ubuntu-latest
32+
c_compiler: clang
33+
cpp_compiler: clang++
34+
exclude:
35+
- os: windows-latest
36+
c_compiler: clang
37+
- os: ubuntu-latest
38+
c_compiler: cl
39+
40+
steps:
41+
- uses: actions/checkout@v3
42+
43+
- name: Set reusable strings
44+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
45+
id: strings
46+
shell: bash
47+
run: |
48+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
49+
50+
- name: Configure CMake
51+
run: >
52+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
53+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
54+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
55+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
56+
-S ${{ github.workspace }}
57+
58+
- name: Build
59+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

0 commit comments

Comments
 (0)