-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (63 loc) · 2.15 KB
/
sonarqube.yml
File metadata and controls
74 lines (63 loc) · 2.15 KB
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
67
68
69
70
71
72
73
74
name: SonarQube
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
merge_group:
jobs:
build-and-analyze:
runs-on: macos-15
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for better SonarQube analysis
# Install Ruby (for Slather) and Slather itself
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4.3
- name: Install slather
run: gem install slather
- name: Install Dependencies
run: swift package resolve
- name: Build for testing
run: |
xcodebuild build-for-testing \
-scheme 'FormbricksSDK' \
-sdk iphonesimulator \
-config Debug \
-destination 'platform=iOS Simulator,name=iPhone SE (3rd generation),OS=18.2' \
-derivedDataPath build \
-enableCodeCoverage YES
- name: Verify test bundle
run: |
ls -la build/Build/Products/
ls -la build/Build/Products/Debug-iphonesimulator/
ls -la build/Build/Products/Debug-iphonesimulator/FormbricksSDKTests.xctest || echo "Test bundle not found"
- name: Run tests
run: |
xcodebuild test-without-building \
-scheme 'FormbricksSDK' \
-sdk iphonesimulator \
-config Debug \
-destination 'platform=iOS Simulator,name=iPhone SE (3rd generation),OS=18.2' \
-derivedDataPath build \
-enableCodeCoverage YES
# Generate Cobertura XML from that Xcode-derived coverage
- name: Generate Cobertura XML
run: |
slather coverage \
--scheme FormbricksSDK \
--cobertura-xml \
--output-directory coverage \
.
# Run SonarCloud scan, pointing at the Cobertura report
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@ffc3010689be73b8e5ae0c57ce35968afd7909e8 # v5.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}