-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (79 loc) · 2.65 KB
/
ci-2022-cpp.yml
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
98
99
100
101
102
103
104
name: CI 2022 C++
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-12]
compiler: [gnu, msvc, clang]
arch: [x86, x64]
exclude:
- os: ubuntu-22.04
compiler: msvc
- os: macos-12
compiler: msvc
- os: macos-12
compiler: gnu
- os: macos-12
arch: x86
- os: ubuntu-22.04
arch: x86
- os: windows-2022
compiler: gnu
- os: windows-2022
compiler: clang
include:
- os: ubuntu-22.04
nproc: "-j$(nproc)"
mkdir_force: -p
- os: windows-2022
nproc: -j4
mkdir_force: -Force
- os: macos-12
nproc: "-j$(sysctl -n hw.ncpu)"
mkdir_force: -p
- compiler: gnu
cc: gcc-12
cxx: g++-12
ccmac: gcc-12
cxxmac: g++-12
- compiler: clang
cc: clang-14
cxx: clang++-14
ccmac: clang
cxxmac: clang++
- compiler: msvc
cc: cl
cxx: cl
- arch: x86
archWin: -A Win32
archLin: -m32
- arch: x64
archWin: -A x64
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
steps:
- uses: actions/checkout@v2
- name: Configure CMake for Linux
if: runner.os == 'Linux'
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
- name: Configure CMake for Windows
if: runner.os == 'Windows'
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -G "Visual Studio 17 2022" ${{ matrix.archWin }}
- name: Configure CMake for macOS
if: runner.os == 'macOS'
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=${{ matrix.ccmac }} -DCMAKE_CXX_COMPILER=${{ matrix.cxxmac }}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} ${{ matrix.nproc }}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest ${{ matrix.nproc }} -C ${{env.BUILD_TYPE}}