-
Notifications
You must be signed in to change notification settings - Fork 15
62 lines (59 loc) · 2.07 KB
/
sonarsource.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
name: SonarCloud
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: ${{ env.DESIRED_CMAKE_VERSION }}
- name: Install packages
run: |
sudo apt-get install bison ccache flex lcov libfl-dev \
python3-dev python3-pip
shell: bash
- name: Set up Python3
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Prepare Pip
run: |
python3 -m pip config set global.break-system-packages true
- name: Install Python3 dependencies
working-directory: ${{runner.workspace}}/nmodl
run: |
pip3 install -U pip setuptools
pip3 install --user -r requirements.txt
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Configure project
shell: bash
working-directory: ${{runner.workspace}}/nmodl
run: |
mkdir build
cmake -S . -B build \
-DPYTHON_EXECUTABLE=$(which python3) \
-DCMAKE_BUILD_TYPE=Release
- name: Run build-wrapper
working-directory: ${{runner.workspace}}/nmodl
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build --verbose --parallel
- name: Run sonar-scanner
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"