-
Notifications
You must be signed in to change notification settings - Fork 3
121 lines (105 loc) · 3.59 KB
/
pr-check.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
name: PR check
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:
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
id: cache-step
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 libgit2-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
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
static-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install libboost-program-options-dev libgit2-dev
- run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On
- uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: 19
database: 'build'
style: 'file' # Use .clang-format config file
tidy-checks: '' # Use .clang-tidy config file
# only 'update' a single comment in a pull request's thread.
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: exit 1