-
Notifications
You must be signed in to change notification settings - Fork 105
262 lines (260 loc) · 8.32 KB
/
main.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: "main"
on: # @see https://help.github.com/en/articles/events-that-trigger-workflows#webhook-events
push:
branches: # Array of patterns that match refs/heads
- v2
pull_request:
branches: [v2]
jobs:
format:
name: Format
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: CI Job
shell: bash
run: |
bash ci/do_ci.sh format ;
document: # job id, can be any string
name: Document
# This job runs on Linux
strategy:
matrix:
include:
- os: ubuntu-22.04
triplet: x64-linux
cc: gcc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build & Test
shell: bash
run: |
sudo apt-get update ;
sudo apt-get install --no-install-recommends --no-install-suggests -y doxygen graphviz ;
bash ci/do_ci.sh document ;
- name: Deploy
if: ${{ github.event_name == 'push' }}
env:
COMMIT_REF: ${{ github.ref }}
DOCUMENT_DEPLOY_KEY: ${{ secrets.DOCUMENT_DEPLOY_KEY }}
shell: bash
run: |
cd docs/output ;
git config --global init.defaultBranch main ;
git init ;
git add . ;
mkdir -p $HOME/.ssh ;
chmod 700 $HOME/.ssh ;
echo "$DOCUMENT_DEPLOY_KEY" > $HOME/.ssh/deploy.key ;
chmod 600 $HOME/.ssh/deploy.key ;
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=$HOME/.ssh/deploy.key" ;
git -c user.name='owent' -c user.email='[email protected]' commit -m "Delpoy document for $COMMIT_REF";
git push -f -q [email protected]:owent/libcopp-doc.git HEAD:main ;
unix_build: # job id, can be any string
name: Unix Build
# This job runs on Linux
strategy:
matrix:
include:
- os: ubuntu-22.04
triplet: x64-linux
cc: gcc
build_shared_libs: "ON"
- os: ubuntu-22.04
triplet: x64-linux
cc: gcc
build_shared_libs: "OFF"
- os: ubuntu-22.04
triplet: x64-linux
cc: gcc-latest
mode: memcheck
- os: ubuntu-22.04
triplet: x64-linux
cc: gcc-latest
no_exception: 1
- os: ubuntu-22.04
triplet: x64-linux
cc: gcc-latest
no_rtti: 1
- os: ubuntu-22.04
triplet: x64-linux
cc: gcc-latest
thread_unsafe: 1
- os: ubuntu-20.04
triplet: x64-linux
cc: gcc-4.8
- os: ubuntu-22.04
triplet: x64-linux
cc: clang-latest
- os: macos-latest
triplet: x64-osx
cc: clang-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build & Test
shell: bash
env:
USE_CC: ${{ matrix.cc }}
BUILD_SHARED_LIBS: ${{ matrix.build_shared_libs }}
NO_EXCEPTION: ${{ matrix.no_exception }}
NO_RTTI: ${{ matrix.no_rtti }}
THREAD_UNSAFE: ${{ matrix.thread_unsafe }}
CI_MODE: ${{ matrix.mode }}
run: |
if [[ "xgcc-4.8" == "x$USE_CC" ]]; then
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial main'
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial universe'
sudo apt-get update
sudo apt-get install --no-install-recommends --no-install-suggests -y g++-4.8
if [[ "x$CI_MODE" == "x" ]]; then
CI_MODE=gcc.legacy.test
fi
elif [[ "x$USE_CC" =~ xclang.* ]]; then
if [[ "x$CI_MODE" == "x" ]]; then
CI_MODE=clang.test
fi
else
if [[ "x$CI_MODE" == "x" ]]; then
CI_MODE=gcc.test
fi
fi
bash ci/do_ci.sh $CI_MODE
vs2019_2022_build: # job id, can be any string
name: Visual Studio Build
strategy:
matrix:
include:
- os: windows-latest
generator: "Visual Studio 17 2022"
build_shared_libs: "ON"
platform: x64
- os: windows-latest
generator: "Visual Studio 17 2022"
build_shared_libs: "OFF"
platform: x64
- os: windows-2019
generator: "Visual Studio 16 2019"
build_shared_libs: "OFF"
platform: x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build & Test
shell: pwsh
env:
CMAKE_GENERATOR: ${{ matrix.generator }}
CMAKE_PLATFORM: ${{ matrix.platform }}
BUILD_SHARED_LIBS: ${{ matrix.build_shared_libs }}
CONFIGURATION: RelWithDebInfo
CI_MODE: ${{ matrix.mode }}
run: |
if(!(Test-Path ENV:CI_MODE)) {
$ENV:CI_MODE="msvc.2019+.test"
}
pwsh -File ci/do_ci.ps1 "$ENV:CI_MODE"
mingw_build: # job id, can be any string
name: MinGW Build
strategy:
matrix:
include:
- os: windows-latest
build_shared_libs: "ON"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build & Test
shell: bash
env:
BUILD_SHARED_LIBS: ${{ matrix.build_shared_libs }}
run: |
C:/msys64/msys2_shell.cmd -mingw64 -defterm -no-start -here -lc "ci/do_ci.sh msys2.mingw.test"
- name: Cache packages
uses: actions/cache@v2
with:
path: |
C:/msys64/var/cache/pacman/pkg
C:/msys64/var/lib/pacman
key: ${{ runner.os }}-${ hashFiles('.github/workflows/main.yml') } }}
coverage: # job id, can be any string
name: Coverage
# This job runs on Linux
strategy:
matrix:
include:
- os: ubuntu-22.04
triplet: x64-linux
cc: gcc
gcov_flags: "--coverage -fprofile-arcs -ftest-coverage"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Generate coverage
shell: bash
env:
USE_CC: ${{ matrix.cc }}
USE_SSL: ${{ matrix.ssl }}
GCOV_FLAGS: "${{ matrix.gcov_flags }}"
run: |
SETUP_INSTALL_LCOV=0
which lcov || SETUP_INSTALL_LCOV=1
set -e
if [[ $SETUP_INSTALL_LCOV -ne 0 ]]; then
sudo apt update -y
sudo apt install --no-install-recommends --no-install-suggests -y lcov
fi
bash ci/do_ci.sh coverage ;
- name: Uploaded code coverage
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}} # not required for public repos
fail_ci_if_error: true
file: ${{ github.workspace }}/build_jobs_coverage/coverage.info
codeql:
name: CodeQL
# This job runs on Linux
strategy:
fail-fast: false
matrix:
include:
- cc: gcc
triplet: x64-linux
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
shell: bash
env:
USE_CC: ${{ matrix.cc }}
USE_SSL: ${{ matrix.ssl }}
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}
run: |
bash ci/do_ci.sh codeql.configure
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yml
- name: Build
shell: bash
env:
USE_CC: ${{ matrix.cc }}
USE_SSL: ${{ matrix.ssl }}
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}
run: |
bash ci/do_ci.sh codeql.build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:cpp"