Skip to content

[DEV-12345] DO NOT MERGE - TESTING #39

[DEV-12345] DO NOT MERGE - TESTING

[DEV-12345] DO NOT MERGE - TESTING #39

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: Download and Configure Build Wrapper
run: |
curl -L -o build-wrapper-macosx.zip "https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip"
unzip build-wrapper-macosx.zip -d $HOME/.sonar
export PATH="$HOME/.sonar/build-wrapper-macosx-x86:$PATH"
- name: Download and Configure Sonar Scanner
run: |
curl -L -o sonar-scanner.zip "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-latest.zip"
unzip sonar-scanner.zip -d $HOME/.sonar
export PATH="$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION/bin:$PATH"
- name: Execute Build Wrapper
run: |
$HOME/.sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 \
--out-dir bw-output \
xcodebuild -workspace Example/TrustlySDK.xcworkspace \
-scheme TrustlySDK-Example \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=17.4' \
clean build
- name: Run SonarQube Analysis
run: |
sonar-scanner \
-Dsonar.host.url=${{ env.SONAR_HOST_URL }} \
-Dsonar.login=${{ env.SONAR_TOKEN }} \
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} \
-Dsonar.projectName=${{ env.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.sources="." \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.cfamily.threads=4 \
-Dsonar.cfamily.cache.enabled=true \
-Dsonar.exclusions="Pods/**/*, Example/Tests/**" \
-Dsonar.scm.disabled=true \
-Dsonar.verbose=true