Skip to content

Commit 806af71

Browse files
committed
Build C++ on Linux/macOS/Windows
1 parent 7a0a18f commit 806af71

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

.github/workflows/build-cpp.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ on:
66

77
jobs:
88
build:
9-
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, macos-latest, windows-latest]
12+
runs-on: ${{ matrix.os }}
1013
steps:
1114
- uses: actions/checkout@v4
1215
with:
@@ -19,22 +22,41 @@ jobs:
1922
else
2023
echo "present=false" >> "$GITHUB_OUTPUT"
2124
fi
25+
- name: Configure
26+
if: steps.detect.outputs.present == 'true'
27+
shell: bash
28+
run: |
29+
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
30+
cmake -S cpp -B cppbuild -DEPOCH_COVERAGE=ON
31+
else
32+
cmake -S cpp -B cppbuild
33+
fi
2234
- name: Build
2335
if: steps.detect.outputs.present == 'true'
36+
shell: bash
2437
run: |
25-
cmake -S cpp -B cppbuild -DEPOCH_COVERAGE=ON
26-
cmake --build cppbuild
38+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
39+
cmake --build cppbuild --config Release
40+
else
41+
cmake --build cppbuild
42+
fi
2743
- name: Test
2844
if: steps.detect.outputs.present == 'true'
29-
run: ctest --test-dir cppbuild --output-on-failure
45+
shell: bash
46+
run: |
47+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
48+
ctest --test-dir cppbuild -C Release --output-on-failure
49+
else
50+
ctest --test-dir cppbuild --output-on-failure
51+
fi
3052
- name: Coverage
31-
if: steps.detect.outputs.present == 'true'
53+
if: steps.detect.outputs.present == 'true' && matrix.os == 'ubuntu-latest'
3254
run: |
3355
python -m pip install --upgrade pip
3456
python -m pip install gcovr
3557
gcovr -r . --object-directory cppbuild --xml-pretty -o cpp/coverage.xml --filter cpp
3658
- name: Upload coverage
37-
if: steps.detect.outputs.present == 'true'
59+
if: steps.detect.outputs.present == 'true' && matrix.os == 'ubuntu-latest'
3860
uses: codecov/codecov-action@v4
3961
with:
4062
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)