Skip to content

Update sonar scanner to latest 5.x #436

Update sonar scanner to latest 5.x

Update sonar scanner to latest 5.x #436

Workflow file for this run

name: CI Build with Unit Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: macos-latest
env:
BUILD_WRAPPER_OUT_DIR: DerivedData/compilation-database
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create build-wrapper dir
run: mkdir -p ${{ env.BUILD_WRAPPER_OUT_DIR }}
- name: Build RollbarCommon
working-directory: RollbarCommon
run: swift build -v --build-path ../DerivedData
- name: Build RollbarDeploys
working-directory: RollbarDeploys
run: swift build -v
- name: Build RollbarNotifier
working-directory: RollbarNotifier
run: swift build -v
- name: Build RollbarAUL
working-directory: RollbarAUL
run: swift build -v
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: build-wrapper xcodebuild RollbarCommon
run: |
build-wrapper-macosx-x86 \
--out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} \
xcodebuild \
-workspace RollbarSDK.xcworkspace \
-scheme RollbarCommon \
-derivedDataPath DerivedData \
build
- name: SonarCloud RollbarCommon
run: |
xcodebuild \
test \
-workspace RollbarSDK.xcworkspace \
-scheme RollbarCommon \
-derivedDataPath DerivedData
-enableCodeCoverage YES
CODE_SIGN_IDENTITY="-"
CODE_SIGNING_REQUIRED=NO
- name: SonarCloud RollbarDeploys
run: |
build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} xcodebuild -workspace RollbarSDK.xcworkspace -scheme RollbarDeploys -derivedDataPath DerivedData -enableCodeCoverage YES build test CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO
- name: SonarCloud RollbarNotifier
run: |
build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} xcodebuild -workspace RollbarSDK.xcworkspace -scheme RollbarNotifier -derivedDataPath DerivedData -enableCodeCoverage YES build test CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO
- name: SonarCloud RollbarAUL
run: |
build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} xcodebuild -workspace RollbarSDK.xcworkspace -scheme RollbarAUL -derivedDataPath DerivedData -enableCodeCoverage YES build test CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO
- name: Collect coverage into one XML report
run: |
bash xccov-to-sonarqube-generic.sh DerivedData/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml
- name: Run SonarScanner Analysis
run: |
sonar-scanner \
-X \
-Dsonar.cfamily.build-wrapper-output=${{ env.BUILD_WRAPPER_OUT_DIR }} \
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION_KEY }} \
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} \
-Dsonar.coverageReportPaths=sonarqube-generic-coverage.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}