-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (61 loc) · 2.32 KB
/
swift.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
name: Swift
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main", "develop" ]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: swift-actions/[email protected]
with:
swift-version: "5.10.1"
- name: Install SwiftLint
run: brew install swiftlint
- name: Build
run: xcodebuild -scheme 'PCPClient-Package' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.0'
- name: Run SwiftLint
run: |
set -o pipefail
swiftlint lint --strict --quiet | sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 title=Lint error,file=\1,line=\2,col=\3::\5\n\1:\2:\3/'
- name: Run tests
run: xcodebuild -scheme 'PCPClient-Package' -destination 'platform=iOS Simulator,name=iPhone 15 Pro' -skipPackagePluginValidation -derivedDataPath Build/ -enableCodeCoverage YES clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath Coverage.xcresult test
- name: Make Sonar Compatible Code Coverage Report
run: bash xccov-to-sonarqube-generic.sh Coverage.xcresult >Coverage.xml
- name: Upload Coverage XML
uses: actions/upload-artifact@v4
with:
name: Coverage
path: Coverage.xml
retention-days: 1
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Download Coverage XML
uses: actions/download-artifact@v4
with:
name: Coverage
- name: Update Paths for SonarCloud
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "/Users/runner/work/PCP-client-iOS-SDK/PCP-client-iOS-SDK/"
replace: ""
regex: false
include: "Coverage.xml"
- name: Run SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.coverageReportPaths=Coverage.xml
-Dsonar.verbose=true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}