feat: v2 to v3+ adapter #1026
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
name: SonarCloud | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Build | |
runs-on: macos-latest | |
env: | |
SONAR_SCANNER_VERSION: 4.6.2.2472 | |
SONAR_SERVER_URL: "https://sonarcloud.io" | |
DERIVED_DATA: $HOME/.DerivedData | |
XCTEST_WORKSPACE: GrowingAnalytics.xcworkspace | |
XCTEST_SCHEME: GrowingAnalyticsTests | |
XCTEST_TESTPLAN: GrowingAnalyticsTests | |
XCTEST_DESTINATION: "platform=iOS Simulator,name=iPhone 13" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Force Xcode 13.4.1 | |
run: sudo xcode-select -switch /Applications/Xcode_13.4.1.app | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
- name: Download and set up sonar-scanner | |
env: | |
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-macosx.zip | |
run: | | |
mkdir -p $HOME/.sonar | |
mkdir -p $HOME/.cache | |
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} | |
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ | |
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-macosx/bin" >> $GITHUB_PATH | |
- name: Download and set up build-wrapper | |
env: | |
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-macosx-x86.zip | |
run: | | |
curl -sSLo $HOME/.sonar/build-wrapper-macosx-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} | |
unzip -o $HOME/.sonar/build-wrapper-macosx-x86.zip -d $HOME/.sonar/ | |
echo "$HOME/.sonar/build-wrapper-macosx-x86" >> $GITHUB_PATH | |
- name: Cache cocoapods | |
uses: actions/cache@v3 | |
with: | |
path: Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Pod Install | |
run: pod install | |
- name: Run build-wrapper | |
run: | | |
mkdir -p ${{ env.DERIVED_DATA }} | |
build-wrapper-macosx-x86 --out-dir ${{ env.DERIVED_DATA }}/compilation-database \ | |
xcodebuild test -workspace ${{ env.XCTEST_WORKSPACE }} \ | |
-scheme ${{ env.XCTEST_SCHEME }} \ | |
-testPlan ${{ env.XCTEST_TESTPLAN }} \ | |
-destination "${{ env.XCTEST_DESTINATION }}" \ | |
-enableCodeCoverage YES \ | |
-derivedDataPath ${{ env.DERIVED_DATA }} | |
- name: Parse xcresult to Sonarqube xml | |
run: | | |
brew tap a7ex/homebrew-formulae | |
brew install xcresultparser | |
xcresultparser -c -o xml ${{ env.DERIVED_DATA }}/Logs/Test/*.xcresult/ > ${{ env.DERIVED_DATA }}/sonarqube-generic-coverage.xml | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner \ | |
-Dsonar.host.url="${{ env.SONAR_SERVER_URL }}" \ | |
-Dsonar.cfamily.build-wrapper-output="${{ env.DERIVED_DATA }}/compilation-database" \ | |
-Dsonar.coverageReportPaths="${{ env.DERIVED_DATA }}/sonarqube-generic-coverage.xml" |