code rev #654
Workflow file for this run
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
### reusable workflow can't be called with a strategy matrix | |
### and so are not used as a workflow without a strategy matrix | |
### to feed in inputs parameters is useless in my case. | |
### Sonar cloud job the cache in $HOME/.sonar doesn't save sub-dirs | |
### so can't be cached. | |
name: ci-sonar | |
on: | |
push: | |
paths-ignore: | |
- 'doc/**' | |
- '.gitignore' | |
- '.gitattributes' | |
- 'README.md' | |
- 'LICENSE' | |
- 'wave_generators.r' | |
#branches: | |
# - master | |
pull_request: | |
# branches: [ master ] | |
paths-ignore: | |
- 'doc/**' | |
- '.gitignore' | |
- '.gitattributes' | |
- 'README.md' | |
- 'LICENSE' | |
- 'wave_generators.r' | |
#permissions: read-all | |
jobs: | |
sonarcloud: | |
name: SonarCloud Analysis (x64-windows, Debug) | |
runs-on: windows-2022 | |
env: | |
SONAR_SCANNER_VERSION: 5.0.1.3006 | |
SONAR_SERVER_URL: "https://sonarcloud.io" | |
BUILD_WRAPPER_OUT_DIR: build # Directory where build-wrapper output will be placed | |
HOME: c:\ | |
steps: | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: fetch vcpkg | |
run: | | |
cd C:\vcpkg | |
git fetch | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: create build dir | |
run: mkdir build | |
- uses: actions/cache@v2 | |
id: dep-cache | |
with: | |
path: C:/vcpkg/packages | |
key: ${{ runner.os }}-x64-windows-dep-cache-${{ hashFiles('**/*') }} | |
restore-keys: ${{ runner.os }}-x64-windows-dep-cache | |
- uses: actions/cache@v2 | |
id: sonar-cache | |
with: | |
path: | | |
${{ env.HOME }}\sonar\ | |
# ${{ env.HOME }}\.sonar\/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-windows | |
# ${{ env.HOME }}\.sonar\/build-wrapper-win-x86 | |
key: ${{ runner.os }}-sonar-cache-${{ hashFiles('**/*') }} | |
restore-keys: ${{ runner.os }}-sonar-cache | |
- name: Download and set up sonar-scanner | |
if: steps.sonar-cache.outputs.cache-hit != 'true' | |
env: | |
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-windows.zip | |
run: | | |
New-Item -Force -ItemType directory -Path ${{ env.HOME }}\sonar | |
curl -sSLo ${{ env.HOME }}\sonar\sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} | |
unzip -o ${{ env.HOME }}\sonar\sonar-scanner.zip -d ${{ env.HOME }}\sonar\ | |
rm ${{ env.HOME }}\sonar\sonar-scanner.zip | |
- name: Download and set up build-wrapper | |
if: steps.sonar-cache.outputs.cache-hit != 'true' | |
env: | |
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-win-x86.zip | |
run: | | |
curl -sSLo ${{ env.HOME }}\sonar\build-wrapper.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} | |
unzip -o ${{ env.HOME }}\sonar\build-wrapper.zip -d ${{ env.HOME }}\sonar\ | |
rm ${{ env.HOME }}\sonar\build-wrapper.zip | |
- name: set up PATH | |
run: | | |
echo "${{ env.HOME }}\sonar\sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-windows\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 | |
echo "${{ env.HOME }}\sonar\build-wrapper-win-x86" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 | |
- name: cmake generator | |
run: | | |
. "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
cmake -DVCPKG_TARGET_TRIPLET=x64-windows -A x64 -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug .. | |
working-directory: build | |
- name: cmake build sonar wrapper | |
run: | | |
. "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
build-wrapper-win-x86-64 --out-dir . cmake --build . --config=Debug -j4 | |
working-directory: build | |
- name: CTest (XML report) | |
run: ctest --output-junit report.xml | |
working-directory: build | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" |