Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,51 @@ jobs:
- uses: actions/checkout@v2
- name: Check all entangled files are in sync with Markdown
run: make check
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
architecture: "x64"
- name: Install Python dependencies
run: make py-deps
- name: Install emscripten
uses: mymindstorm/setup-emsdk@v5
with:
version: 1.39.17
actions-cache-folder: 'emsdk-cache'
- name: Cache SonarCloud Build Wrapper
id: cache-bw
uses: actions/cache@v2
with:
path: build-wrapper-linux-x86
key: ${{ runner.os }}-bw
- name: Install SonarCloud Build Wrapper
if: steps.cache-bw.outputs.cache-hit != 'true'
run: |
wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip build-wrapper-linux-x86.zip
rm -f build-wrapper-linux-x86.zip
- name: Remove all compiled files
run: make clean-compiled
- name: Compile C++ files using wrapper
run: ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make all
- name: Restore wasm
# As we want to analyse files in git not files we just build
run: git restore src/js/newtonraphsonwasm.js src/js/newtonraphsonwasm.wasm
- name: Relativize bw-output
# Build wrapper runs on CI server while sonar-scanner runs in Docker container need to adjust paths
run: perl -pi -e 's@/home/runner/work/cpp2wasm/cpp2wasm@/github/workspace@g' bw-output/build-wrapper-dump.json
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
cpp:
# The type of runner that the job will run on
runs-on: ubuntu-latest
Expand Down Expand Up @@ -44,7 +89,7 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"
Expand Down Expand Up @@ -99,7 +144,10 @@ jobs:
- uses: actions/checkout@v2

- name: Install emscripten
uses: mymindstorm/setup-emsdk@v4
uses: mymindstorm/setup-emsdk@v5
with:
version: 1.39.17
actions-cache-folder: 'emsdk-cache'

- name: Build WebAssembly module
run: make build-wasm
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ apache2/cgi-bin/newtonraphson

# other ignores
node_modules

# SonarCloud
.scannerwork
build-wrapper-linux-x86.zip
build-wrapper-linux-x86/
bw-output/
15 changes: 0 additions & 15 deletions .sonarcloud.properties

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

* C++ in SonarCloud analysis ([#73](https://github.com/NLESC-JCER/cpp2wasm/issues/73))

## [0.2.0] - 2020-06-09

### Added
Expand Down
14 changes: 14 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sonar.organization=nlesc-jcer
sonar.projectKey=NLESC-JCER_cpp2wasm

# excluded files generated by emscripten and 3rd party dependencies
sonar.exclusions=src/js/newtonraphsonwasm.js,deps/nlohmann/json.hpp
sonar.cpd.exclusions=src/js/newtonraphsonwasm.js,deps/nlohmann/json.hpp

# Ignore C++ until sonar.cfamily.build-wrapper-output is configured
sonar.cfamily.build-wrapper-output=bw-output
sonar.cfamily.threads=1
sonar.cfamily.cache.enabled=false

# No coverage possible, so ignore all files
sonar.coverage.exclusions=**/*