-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodemagic.yaml
54 lines (53 loc) · 2.66 KB
/
codemagic.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
workflows:
ios-sonarcloud:
name: iOS sonarcloud
instance_type: mac_pro
environment:
vars:
XCODE_PROJECT: "swiftqube.xcodeproj"
XCODE_SCHEME: "swiftqube"
BUNDLE_ID: "io.codemagic.swiftqube"
SONAR_TOKEN: Encrypted(Z0FBQUFBQmhGQmkxZ255VFp4UHVxVHpESHhRSDJGdFN2Mkw5SmhuUGF4UmFacVZEdkQ0ZzdYNkVyVXRlRy15RDc1RV9fLU14ZWJpbjB3ZGc5S2llNWxrbU55bmZOQ1hlY1hWOTZNdG1lT08tRFJzdXhIa2ZoUGI1Tm5TMGN0d2Rua1l0ZEI3bjNXdlU=) # <-- Put your encrypted Sonar Cloud token here
SONAR_PROJECT_KEY: Encrypted(Z0FBQUFBQmhGQmZ6Qm9yS3BCaU1sXzhzSDFWUk1uYXBGVkFvbERTVE1Sb2VEZ0RSaWkwWDRuS0ZmbGJ5RTFjeC13cG9rSG8wRjYwMDgxTWM1aHRiSEcyUjNLTzgzOVRxRGxIVkFDdXc0Y1ROenFxNEw1QjNUNWtYTFNNZWd2SWhiNkw0QTF4MXFQRng=) # <-- Put your encrypted Sonar Cloud project key here
SONAR_ORG_KEY: Encrypted(Z0FBQUFBQmhGQmdrd3BYMzFsRk5tUmh4X1F5M3BMSVNFdENzOTZIRXJNX2UtVlFsOTdYcnJNRGVqYjFnNG1OdFdUUnowR2dsU0VIcmU0WFlaajhicmpsVnU0V3pINm5NV3c9PQ==) # <-- Put your encrypted Sonar Cloud organisation key here
xcode: 14.1
cocoapods: default
triggering:
events:
- pull_request
branch_patterns:
- pattern: main
include: true
source: false
scripts:
- name: Install Sonar Scanner
script: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install sonar-scanner
- name: Generate debug build
script: |
xcodebuild \
-project "$XCODE_PROJECT" \
-scheme "$XCODE_SCHEME" \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 12 Pro,OS=14.5' \
-derivedDataPath Build/ \
-enableCodeCoverage YES \
clean build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
- name: Convert coverage report to Sonarqube format
script: |
bash xccov-to-sonarqube-generic.sh Build/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml
- name: Generate and upload code analysis report
script: |
export PATH=$PATH:$FCI_BUILD_DIR/sonar-scanner/bin
sonar-scanner \
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
-Dsonar.organization=$SONAR_ORG_KEY \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectVersion=1.0.0 \
-Dsonar.sources=. \
-Dsonar.cfamily.build-wrapper-output.bypass=true \
-Dsonar.coverageReportPaths=sonarqube-generic-coverage.xml \
-Dsonar.c.file.suffixes=- \
-Dsonar.cpp.file.suffixes=- \
-Dsonar.objc.file.suffixes=- \