-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (82 loc) · 3.26 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: C++ build
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- name: "Ubuntu/gcc-11/Release"
os: ubuntu-latest
build_type: "Release"
cc: "gcc-11"
cxx: "g++-11"
generators: "Ninja"
coveralls: false
- name: "Ubuntu/gcc-11/Debug"
os: ubuntu-latest
build_type: "Debug"
cc: "gcc-11"
cxx: "g++-11"
generators: "Ninja"
coveralls: true
- name: "Windows x86_64/Release"
os: windows-latest
build_type: "Release"
generators: "Visual Studio 16 2019"
gen_arch: "x64"
coveralls: false
- name: "Windows x86_32/Release"
os: windows-latest
build_type: "Release"
generators: "Visual Studio 16 2019"
gen_arch: "Win32"
coveralls: false
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: ${{ matrix.config.build_type }}
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
COV: ${{ matrix.config.coveralls }}
COV_UP: ${{ github.event_name == 'push' && matrix.config.coveralls }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
- name: Get compilers (Ubuntu)
if: startsWith(matrix.config.os, 'ubuntu-')
run: |
sudo apt update
sudo apt install ${{env.CC}} ${{env.CXX}}
shell: bash
- name: Add MSBuild to PATH (Windows)
if: startsWith(matrix.config.os, 'windows-')
uses: microsoft/[email protected]
- name: Get Ninja
if: ${{ matrix.config.generators }} == "Ninja"
uses: turtlesec-no/[email protected]
- name: Get Conan
uses: turtlebrowser/[email protected]
- name: Configure Conan (GCC)
if: startsWith(matrix.config.cc, 'gcc-')
run: |
conan install "${{github.workspace}}" -if "${{github.workspace}}/build" --build missing -s build_type=${{env.BUILD_TYPE}}
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Configure Conan
run: conan install "${{github.workspace}}" -if "${{github.workspace}}/build" --build missing -s build_type=${{env.BUILD_TYPE}}
- name: Configure CMake
run: cmake -G "${{ matrix.config.generators }}" -A "${{ matrix.config.gen_arch }}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DJSON_TESTING=ON -DJSON_COVERALLS=${{env.COV}} -DJSON_COVERALLS_UPLOAD=${{env.COV_UP}}
- name: Build
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --parallel
- name: Test
if: ${{ !matrix.config.coveralls || github.event_name != 'push' }}
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
- name: Coveralls
if: ${{ matrix.config.coveralls && github.event_name == 'push' }}
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${{env.BUILD_TYPE}} --target JSON_coveralls --parallel
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}