-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (44 loc) · 1.74 KB
/
build.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
name: Build
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
env:
BUILD_TYPE: Debug
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# with:
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
vcpkgGitCommitId: 76d153790caf0592fce8fc4484aa6db18c7d00d4 # 2024/09/27
vcpkgJsonGlob: 'vcpkg.json'
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=on \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCNTGS_BUILD_TESTS=on \
-DCNTGS_DISCOVER_TESTS=on \
-DCNTGS_TEST_COVERAGE=on
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 2
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} -T test -j 2 --output-on-failure
- name: Code Coverage
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target cntgs-test-cpp17-coverage
# - name: Prepare compile_commands.json for SonarCloud Scan
# run: cmake -DWORKSPACE_ROOT=${{github.workspace}} -P ${{github.workspace}}/cmake/CntgsPrepareCompileCommands.cmake
#- name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} # Needed to get PR information, if any
# SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}