[DEV-12345] DO NOT MERGE - TESTING #54
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: CI | |
on: | |
pull_request: | |
types: [opened, edited, reopened, synchronize] | |
workflow_dispatch: | |
env: | |
GH_TOKEN: ${{ secrets.GIT_TOKEN_SECRET }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
PR_NUMBER: ${{ github.event.number }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_SECRET }} | |
SONAR_HOST_URL: "https://sonarqube.trustly.one" | |
SONAR_PROJECT_KEY: "trustly-ios" | |
SONAR_PROJECT_NAME: "trustly-ios" | |
jobs: | |
SonarQube: | |
runs-on: macOS-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Install CocoaPods | |
run: | | |
gem install cocoapods | |
pod install --project-directory=Example | |
- name: Install xcpretty | |
run: gem install xcpretty | |
- name: Build and Run Tests with Code Coverage | |
run: | | |
echo "printing dir" | |
ls -la | |
swift test --enable-code-coverage | |
- name: Generate Coverage Report | |
run: | | |
xcrun llvm-cov show \ | |
-instr-profile=.build/debug/codecov/default.profdata \ | |
.build/debug/MyPackageTests.xctest/Contents/MacOS/MyPackageTests \ | |
> coverage.report | |
- name: Generate Compilation Database | |
run: | | |
xcodebuild -workspace Example/TrustlySDK.xcworkspace \ | |
-scheme TrustlySDK-Example \ | |
-destination 'platform=iOS Simulator,name=iPhone 15,OS=17.4' \ | |
clean build | xcpretty -r json-compilation-database --output compile_commands.json | |
- name: Install sonar-scanner | |
run: | | |
brew install sonar-scanner | |
- name: Run SonarQube Analysis | |
run: | | |
sonar-scanner \ | |
-Dsonar.host.url=${SONAR_HOST_URL} \ | |
-Dsonar.login=${SONAR_TOKEN} \ | |
-Dsonar.projectKey=${SONAR_PROJECT_KEY} \ | |
-Dsonar.projectName=${SONAR_PROJECT_NAME} \ | |
-Dsonar.pullrequest.base="${{ github.base_ref }}" \ | |
-Dsonar.pullrequest.branch="${{ github.head_ref }}" \ | |
-Dsonar.pullrequest.key="${{ github.event.pull_request.number }}" \ | |
-Dsonar.scm.revision="${{ github.event.pull_request.head.sha }}" \ | |
-Dsonar.scm.disabled=true \ | |
-Dsonar.language=swift \ | |
-Dsonar.sources="." \ | |
-Dsonar.swift.coverage.reportPaths=coverage.report \ | |
-Dsonar.cfamily.compile-commands=compile_commands.json \ | |
-Dsonar.verbose=true |