-
Notifications
You must be signed in to change notification settings - Fork 3
136 lines (112 loc) Β· 3.77 KB
/
build-and-test.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Build and test
on:
pull_request:
branches: [ "master" ]
paths-ignore:
- '.github/**'
- '.gitignore'
- 'README'
- 'LICENCE'
- '*.gif'
- '*.jpeg'
- '*.jpg'
- '*.jpg'
env:
BUILD_TYPE: Release
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
commits:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: webiny/[email protected]
build:
strategy:
fail-fast: false
matrix:
compiler: ['clang','msvc','gcc']
os: ['ubuntu-latest', 'windows-latest']
exclude:
- os: 'ubuntu-latest'
compiler: 'msvc'
- os: 'windows-latest'
# temporary exclude everything
# compiler: 'gcc'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/vcpkg
./build/vcpkg_installed
${{ env.CONAN_USER_HOME }}
~/.cache/pip
${{ env.HOME }}/.cache/vcpkg/archives
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
${{ env.LOCALAPPDATA }}\vcpkg\archives
${{ env.APPDATA }}\vcpkg\archives
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}
- name: Prepare environment
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
ninja: true
conan: false
vcpkg: false
ccache: false
clangtidy: false
cppcheck: false
gcovr: false
opencppcoverage: false
- name: Setup vcpkg and install Boost (Windows)
if: steps.cache-step.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat
./vcpkg install boost
- name: Get boost
if: matrix.os != 'windows-latest'
run: sudo apt-get update && sudo apt-get install libboost-program-options-dev
- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Configure CMake (Windows)
if: matrix.os != 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release
- name: Test
working-directory: ${{ github.workspace }}/build
# Exclude LocalLogRepository test as they write to the filesystem
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure -E "LocalLogRepository"
static-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare environment
run: sudo apt-get update && sudo apt-get install libboost-program-options-dev clang-tidy
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=Off
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release
- name: Static Analysis
run: ln -s ./build/compile_commands.json && run-clang-tidy ./source/
code-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DoozyX/[email protected]
with:
source: 'source test'
extensions: 'hpp,cpp'
clangFormatVersion: 16