-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (66 loc) · 2.31 KB
/
sonarcloud.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
name: sonarcloud scan
on:
push:
branches:
- master
- dev
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: sonarcloud scan
runs-on: ubuntu-latest
env:
CONAN_SYSREQUIRES_MODE: "enabled"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v3
id: sonarscan
- name: Download and set up sonar-scanner
run: |
wget -nv https://cdn.anotherfoxguy.com/sonar-scanner/mofilereader -O run-sonar-scanner
sudo chmod 777 run-sonar-scanner
- name: Prepare cfamily cache timestamp
id: cfamily_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: cfamily cache files
uses: actions/cache@v4
with:
path: cfamily-cache
key: cfamily-cache-${{ steps.cfamily_cache_timestamp.outputs.timestamp }}
restore-keys: |
cfamily-cache-
- name: Cache conan
uses: actions/cache@v4
with:
key: conan-linux-${{ hashFiles('conanfile.txt') }}
path: ~/.conan2/
- name: Install dependencies
run: |
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-cmake.sh" | sudo bash
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash
- name: Configure
run: |
conan profile detect --force
conan install . -s build_type=Release -b missing -pr:b=default
cmake --preset conan-release -DBUILD_TEST=ON -DENABLE_COVERAGE=ON
- name: Run build-wrapper
run: build-wrapper-linux-x86-64 --out-dir bw-output make -j4
- name: Test
continue-on-error: true
run: ctest -j2 --output-on-failure
- name: Generate coverage
run: make gcov
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_SCANNER_EXE: ${{ steps.sonarscan.outputs.sonar-scanner-binary }}
run: ./run-sonar-scanner
- name: Clean Conan pkgs
run: conan cache clean "*" -sbd