File tree Expand file tree Collapse file tree 6 files changed +75
-9
lines changed
CryptomatorCryptoLib.xcodeproj Expand file tree Collapse file tree 6 files changed +75
-9
lines changed Original file line number Diff line number Diff line change @@ -26,13 +26,14 @@ jobs:
26
26
exit $?
27
27
- name : Build and test
28
28
run : set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme 'CryptomatorCryptoLib' -destination "name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES clean test | xcbeautify
29
- - name : Upload code coverage report
29
+ - name : Generate coverage report
30
30
run : |
31
- gem install slather
32
- slather coverage -x --build-directory $DERIVED_DATA_PATH --ignore "$DERIVED_DATA_PATH/SourcePackages/*" --scheme CryptomatorCryptoLib CryptomatorCryptoLib.xcodeproj
33
- bash <(curl -Ls https://coverage.codacy.com/get.sh)
31
+ xcresult_path=$(find $DERIVED_DATA_PATH/Logs/Test -name "*.xcresult" | head -n 1)
32
+ bash Scripts/xccov-to-sonarqube-generic.sh "$xcresult_path" > sonarqube-generic-coverage.xml
33
+ - name : SonarCloud Scan
34
+ uses :
SonarSource/[email protected]
34
35
env :
35
- CODACY_PROJECT_TOKEN : ${{ secrets.CODACY_PROJECT_TOKEN }}
36
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
36
37
continue-on-error : true
37
38
38
39
release :
Original file line number Diff line number Diff line change 1
- --minversion 0.49.2
1
+ --minversion 0.58.3
2
+ --exclude DerivedData
2
3
3
4
# format options
4
5
Original file line number Diff line number Diff line change 3
3
archiveVersion = 1;
4
4
classes = {
5
5
};
6
- objectVersion = 52 ;
6
+ objectVersion = 54 ;
7
7
objects = {
8
8
9
9
/* Begin PBXBuildFile section */
391
391
/* Begin PBXShellScriptBuildPhase section */
392
392
74862A712469A6B2003D81CB /* Lint With SwiftFormat */ = {
393
393
isa = PBXShellScriptBuildPhase;
394
+ alwaysOutOfDate = 1;
394
395
buildActionMask = 2147483647;
395
396
files = (
396
397
);
409
410
};
410
411
749441272616051400435B0B /* Lint With SwiftLint */ = {
411
412
isa = PBXShellScriptBuildPhase;
413
+ alwaysOutOfDate = 1;
412
414
buildActionMask = 2147483647;
413
415
files = (
414
416
);
Original file line number Diff line number Diff line change 1
1
[ ![ Swift Compatibility] ( https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fcryptomator%2Fcryptolib-swift%2Fbadge%3Ftype%3Dswift-versions )] ( https://swiftpackageindex.com/cryptomator/cryptolib-swift )
2
2
[ ![ Platform Compatibility] ( https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fcryptomator%2Fcryptolib-swift%2Fbadge%3Ftype%3Dplatforms )] ( https://swiftpackageindex.com/cryptomator/cryptolib-swift )
3
- [ ![ Codacy Code Quality ] ( https://app.codacy.com/project/badge/Grade/dba85991a19942bab0d3d587522397ef )] ( https://www.codacy.com/gh/cryptomator/cryptolib -swift/dashboard )
4
- [ ![ Codacy Coverage] ( https://app.codacy.com/project/badge/Coverage/dba85991a19942bab0d3d587522397ef )] ( https://www.codacy.com/gh/cryptomator/cryptolib -swift/dashboard )
3
+ [ ![ Quality Gate Status ] ( https://sonarcloud.io/api/project_badges/measure?project=cryptomator_cryptolib-swift&metric=alert_status )] ( https://sonarcloud.io/summary/new_code?id=cryptomator_cryptolib -swift )
4
+ [ ![ Coverage] ( https://sonarcloud.io/api/project_badges/measure?project=cryptomator_cryptolib-swift&metric=coverage )] ( https://sonarcloud.io/summary/new_code?id=cryptomator_cryptolib -swift )
5
5
6
6
# CryptoLib Swift
7
7
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # Source: https://github.com/SonarSource/sonar-scanning-examples/blob/master/swift-coverage/swift-coverage-example/xccov-to-sonarqube-generic.sh
3
+ set -euo pipefail
4
+
5
+ function convert_xccov_to_xml {
6
+ sed -n \
7
+ -e ' /:$/s/&/\&/g;s/^\(.*\):$/ <file path="\1">/p' \
8
+ -e ' s/^ *\([0-9][0-9]*\): 0.*$/ <lineToCover lineNumber="\1" covered="false"\/>/p' \
9
+ -e ' s/^ *\([0-9][0-9]*\): [1-9].*$/ <lineToCover lineNumber="\1" covered="true"\/>/p' \
10
+ -e ' s/^$/ <\/file>/p'
11
+ }
12
+
13
+ function xccov_to_generic {
14
+ local xcresult=" $1 "
15
+
16
+ echo ' <coverage version="1">'
17
+ xcrun xccov view --archive " $xcresult " | convert_xccov_to_xml
18
+ echo ' </coverage>'
19
+ }
20
+
21
+ function check_xcode_version() {
22
+ local major=${1:- 0} minor=${2:- 0}
23
+ return $(( (major >= 14 ) || (major == 13 && minor >= 3 ) ))
24
+ }
25
+
26
+ if ! xcode_version=" $( xcodebuild -version | sed -n ' 1s/^Xcode \([0-9.]*\)$/\1/p' ) " ; then
27
+ echo ' Failed to get Xcode version' 1>&2
28
+ exit 1
29
+ elif check_xcode_version ${xcode_version// ./ } ; then
30
+ echo " Xcode version '$xcode_version ' not supported, version 13.3 or above is required" 1>&2 ;
31
+ exit 1
32
+ fi
33
+
34
+ xcresult=" $1 "
35
+ if [[ $# -ne 1 ]]; then
36
+ echo " Invalid number of arguments. Expecting 1 path matching '*.xcresult'"
37
+ exit 1
38
+ elif [[ ! -d $xcresult ]]; then
39
+ echo " Path not found: $xcresult " 1>&2 ;
40
+ exit 1
41
+ elif [[ $xcresult != * " .xcresult" * ]]; then
42
+ echo " Expecting input to match '*.xcresult', got: $xcresult " 1>&2 ;
43
+ exit 1
44
+ fi
45
+
46
+ xccov_to_generic " $xcresult "
Original file line number Diff line number Diff line change
1
+ # Organization and project keys are defined in SonarCloud UI
2
+ sonar.organization =cryptomator
3
+ sonar.projectKey =cryptomator_cryptolib-swift
4
+
5
+ # Source and test directories
6
+ sonar.sources =Sources
7
+ sonar.tests =Tests
8
+
9
+ # Exclude external dependencies
10
+ sonar.exclusions =DerivedData/**,**/.build/**
11
+
12
+ # Swift-specific settings
13
+ sonar.swift.file.suffixes =.swift
14
+
15
+ # Coverage report path (generated by xccov)
16
+ sonar.coverageReportPaths =sonarqube-generic-coverage.xml
You can’t perform that action at this time.
0 commit comments