-
Notifications
You must be signed in to change notification settings - Fork 7
174 lines (145 loc) · 5.48 KB
/
main_ci.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Main CI
on:
push:
branches: [master]
paths:
- '**/*.cpp'
- '**/*.hpp'
- '**/CMakeLists.txt'
- '**/CMakePresets.txt'
- '**/cmake/**'
- '**/vcpkg.json'
- '.github/workflows/main_ci.yml'
- 'codecov.yml'
pull_request:
branches: [master]
workflow_dispatch:
env:
BUILD_TYPE: Debug
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-cache
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
config: [gcc]
include:
- config: gcc
version: '10'
steps:
- uses: actions/checkout@v2
with:
path: bsa
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: ${{ matrix.version }}
- name: Setup vcpkg
run: |
mkdir ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
cd $VCPKG_INSTALLATION_ROOT
./bootstrap-vcpkg.sh
./vcpkg --version > ${{ github.workspace }}/vcpkg-version.txt
- name: Cache vcpkg
uses: actions/cache@v2
env:
cache-name: vcpkg-cache
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}/*
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('bsa/vcpkg.json', 'vcpkg-version.txt') }}
- name: Setup Environment
run: |
echo "GCOV=gcov-${{ matrix.version }}" >> $GITHUB_ENV
wget https://github.com/ninja-build/ninja/releases/download/v1.11.0/ninja-linux.zip
unzip ninja-linux.zip
sudo mv ninja /usr/local/bin
sudo apt install liblz4-dev zlib1g-dev -y
sudo pip install gcovr
- name: Configure & Build
working-directory: ${{ github.workspace }}/bsa
run: |
cmake --preset linux-gcc-vcpkg -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DBSA_BUILD_DOCS=OFF
cmake --build build
- name: Test
working-directory: ${{ github.workspace }}/bsa/build
env:
gcovr: gcovr -r .. . --coveralls --exclude-unreachable-branches --exclude-function-lines --exclude-throw-branches
run: |
(cd tests && ./tests [src])
${{ env.gcovr }} -f ".*/src/bsa/.*" -f ".*/include/bsa/.*" -o src.json
find -type f -name *.gcda | xargs rm
(cd tests && ./tests [examples])
${{ env.gcovr }} -f ".*/examples/.*" -o examples.json
- name: Collect code coverage
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
files: bsa/build/examples.json,bsa/build/src.json
verbose: true
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
path: bsa
- name: Install OpenCPPCoverage
working-directory: ${{ github.workspace }}/bsa/scripts/opencppcoverage
run: |
choco pack
choco install opencppcoverage -s . -y
- name: Install XNA Framework Redistributables
run: choco install xna -y
- name: Setup vcpkg
run: |
mkdir -p ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
cd $env:VCPKG_INSTALLATION_ROOT
./bootstrap-vcpkg.bat
./vcpkg --version > ${{ github.workspace }}/vcpkg-version.txt
- name: Cache vcpkg
uses: actions/cache@v2
env:
cache-name: vcpkg-cache
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}/*
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('bsa/**/vcpkg.json', 'vcpkg-version.txt') }}
- name: Setup MSVC (x86)
uses: egor-tensin/vs-shell@v2
with:
arch: x86
- name: (xmem) Configure & Build
working-directory: ${{ github.workspace }}/bsa/extras/xmem
run: |
cmake --preset windows-msvc-vcpkg -G Ninja
cmake --build build --config ${{ env.BUILD_TYPE }}
- name: (xmem) Test
working-directory: ${{ github.workspace }}/bsa/extras/xmem/build
run: |
& "$($env:SystemDrive)/Program Files/OpenCppCoverage/OpenCppCoverage.exe" --sources bsa\extras\xmem\src --sources bsa\extras\xmem\tests --cover_children --export_type cobertura -- ctest -C ${{ env.BUILD_TYPE }} -V
- name: (xmem) Collect code coverage
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
files: build/ctestCoverage.xml
working-directory: ${{ github.workspace }}/bsa/extras/xmem/build
- name: (xmem) Install
working-directory: ${{ github.workspace }}/bsa/extras/xmem
run: cmake --install build --config ${{ env.BUILD_TYPE }}
- name: (main) Setup MSVC (x64)
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: (main) Configure & Build
working-directory: ${{ github.workspace }}/bsa
run: |
cmake --preset windows-msvc-vcpkg -G Ninja -DBSA_BUILD_DOCS=OFF
cmake --build build --config ${{ env.BUILD_TYPE }}
- name: (main) Test
working-directory: ${{ github.workspace }}/bsa/build
run: |
& "$($env:SystemDrive)/Program Files/OpenCppCoverage/OpenCppCoverage.exe" --sources bsa\examples --sources bsa\extras\xmem\src --sources bsa\src --sources bsa\tests --cover_children --export_type cobertura -- ctest -C ${{ env.BUILD_TYPE }} -V
- name: (main) Collect code coverage
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
files: build/ctestCoverage.xml
working-directory: ${{ github.workspace }}/bsa/build