-
Notifications
You must be signed in to change notification settings - Fork 119
104 lines (93 loc) · 3.9 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
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
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: Install apt packages
run: |
sudo apt-get install xfonts-100dpi build-essential doxygen lcov libboost-all-dev libopenmpi-dev libmpich-dev libx11-dev libxcomposite-dev mpich openmpi-bin gpg ninja-build flex bison libfl-dev
shell: bash
- name: Setup Xvfb
run: |
sudo apt-get install xvfb
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1600x1200x24 -noreset -nolock -shmem & # run in bg
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Clone nmodl
working-directory: ${{runner.workspace}}/nrn
run: |
git submodule update --init --recursive --force --depth 1 -- external/nmodl
- name: Set up Python@${{ env.PY_MIN_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PY_MIN_VERSION }}
- name: Install Python@${{ env.PY_MIN_VERSION }} dependencies
working-directory: ${{runner.workspace}}/nrn
run: |
python -m pip install --upgrade pip -r nrn_requirements.txt
python -m pip install --upgrade -r external/nmodl/requirements.txt
- name: Set up Python@${{ env.PY_MID_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PY_MID_VERSION }}
- name: Set up Python@${{ env.PY_MAX_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PY_MAX_VERSION }}
- name: Install Python@${{ env.PY_MAX_VERSION }} dependencies
working-directory: ${{runner.workspace}}/nrn
run: |
python -m pip install --upgrade pip -r nrn_requirements.txt
python -m pip install --upgrade -r external/nmodl/requirements.txt
- name: Build & Test
id: build-test
shell: bash
working-directory: ${{runner.workspace}}/nrn
run: |
export SHELL="/bin/bash"
# Compiler setup
export CC=gcc
export CXX=g++
# Python setup
export PYTHON_MIN=$(which $PYTHON_MIN_NAME);
export PYTHON_MID=$(which $PYTHON_MID_NAME);
export PYTHON_MAX=$(which $PYTHON_MAX_NAME);
mkdir build
# CMake options & flags
cmake_args=(-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="$CC" \
-DCMAKE_CXX_COMPILER="$CXX" \
-DNRN_ENABLE_BACKTRACE=ON \
-DNRN_ENABLE_CORENEURON=ON \
-DNRN_ENABLE_INTERVIEWS=ON \
-DNRN_ENABLE_MPI=ON \
-DNRN_ENABLE_PERFORMANCE_TESTS=OFF \
-DNRN_ENABLE_PYTHON=ON \
-DNRN_ENABLE_PYTHON_DYNAMIC=ON \
-DNRN_PYTHON_DYNAMIC="${PYTHON_MIN};${PYTHON_MAX}" \
-DNRN_PYTHON_EXTRA_FOR_TESTS=${PYTHON_MID} \
-DNRN_ENABLE_TESTS=ON)
cmake -S . -B build "${cmake_args[@]}"
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Run build-wrapper
working-directory: ${{runner.workspace}}/nrn
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
- name: Run sonar-scanner
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 }}"