Skip to content

Commit 3f7851a

Browse files
committed
Test cmake builds on github
1 parent 5895329 commit 3f7851a

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/build-cmake.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- jt-*
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ${{ format('{0}-latest', matrix.os) }}
13+
strategy:
14+
matrix:
15+
os:
16+
- ubuntu
17+
- windows
18+
- macos
19+
compiler:
20+
- msvc
21+
- gcc
22+
exclude: # exclude invalid combinations of os/compiler
23+
- os: ubuntu
24+
compiler: msvc
25+
- os: macos
26+
compiler: msvc
27+
include: # Windows adds .exe to the file names, msvc puts them in config-specific subdirs
28+
- os: windows
29+
ext: .exe
30+
- compiler: msvc
31+
buildconfig: /Debug
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Configure CMake (Windows - MSVC) # MSVC on windows uses a different generator
36+
if: matrix.os == 'windows' && matrix.compiler == 'msvc'
37+
run: |
38+
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Debug
39+
40+
- name: Configure CMake (Not Window + MSVC) # All other platforms use Unix Makefiles
41+
if: matrix.os != 'windows' || matrix.compiler != 'msvc'
42+
run: |
43+
cmake -S . -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
44+
45+
- name: Build
46+
run: cmake --build build
47+
48+
- uses: actions/upload-artifact@v4
49+
with:
50+
name: ${{ matrix.os }}
51+
path: |
52+
build${{ matrix.buildconfig }}/basic${{ matrix.ext }}
53+
build${{ matrix.buildconfig }}/fracas${{ matrix.ext }}
54+
build${{ matrix.buildconfig }}/havilah${{ matrix.ext }}
55+
build${{ matrix.buildconfig }}/kingdoms${{ matrix.ext }}
56+
build${{ matrix.buildconfig }}/neworigins${{ matrix.ext }}
57+
build${{ matrix.buildconfig }}/standard${{ matrix.ext }}
58+
59+
- name: Unit Tests
60+
if: matrix.os == 'ubuntu' # Currently, unit tests only work correctly on ubuntu
61+
run: ./build/unittest

0 commit comments

Comments
 (0)