Merge pull request #93 from rpreen/pre-commit-ci-update-config #601
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Configuration script for github continuous integration service | |
name: SonarScanner | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- "*.md" | |
- "*.cff" | |
- "env/csv/*.csv" | |
- "env/maze/*.txt" | |
- "cfg/*.json" | |
- "python/*.py" | |
- "python/notebooks/*.ipynb" | |
pull_request: | |
branches: [master] | |
paths-ignore: | |
- "*.md" | |
- "*.cff" | |
- "env/csv/*.csv" | |
- "env/maze/*.txt" | |
- "cfg/*.json" | |
- "python/*.py" | |
- "python/notebooks/*.ipynb" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
CC: gcc-9 | |
CXX: g++-9 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Configure and Build | |
working-directory: build | |
run: | | |
sudo apt install lcov gcovr | |
cmake .. -DCMAKE_BUILD_TYPE=Debug -DXCSF_PYLIB=OFF -DENABLE_TESTS=ON -DPARALLEL=ON -DUSE_GCOV=ON | |
wget -q https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip | |
unzip -q build-wrapper-linux-x86.zip | |
cp ./build-wrapper-linux-x86/libinterceptor-x86_64.so ./build-wrapper-linux-x86/libinterceptor-haswell.so | |
./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make clean all | |
- name: Report code coverage | |
run: | | |
lcov --directory . --capture --output-file lcov.info | |
lcov --remove lcov.info '/usr/*' '*/extlib/*' '*/lib/*' '*/test/*' --output-file coverage.info | |
lcov --list coverage.info; | |
gcovr -r ./ -x > report.xml | |
curl -Os https://uploader.codecov.io/latest/linux/codecov | |
chmod +x codecov | |
./codecov | |
- name: Setup sonarqube | |
uses: warchant/setup-sonar-scanner@v3 | |
- name: Sonarqube coverage | |
run: | | |
gcovr --sonarqube > coverage.xml | |
- name: Run sonarqube | |
run: sonar-scanner | |
-Dsonar.host.url=https://sonarcloud.io/ | |
-Dsonar.login=${{ secrets.SONAR_TOKEN }} | |
-Dsonar.projectKey=rpreen_xcsf | |
-Dsonar.organization=rpreen | |
-Dsonar.projectVersion=1.0 | |
-Dsonar.projectBaseDir=./ | |
-Dsonar.cfamily.build-wrapper-output=build/bw-output | |
-Dsonar.cfamily.cache.enabled=false | |
-Dsonar.cfamily.threads=1 | |
-Dsonar.coverage.exclusions="python/**,test/**,lib/**,doc/**" | |
-Dsonar.exclusions="python/**,test/**,lib/**,doc/**" | |
-Dsonar.sourceEncoding=UTF-8 | |
-Dsonar.coverageReportPaths=coverage.xml | |
... |