forked from omise/omise-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.2 KB
/
main.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
67
68
69
70
name: CI
on:
workflow_dispatch:
push:
branches: [ master, develop ]
pull_request:
types: [opened, synchronize, reopened]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run linting
uses: norio-nomura/[email protected]
with:
args: --strict
test:
runs-on: macos-latest
env:
BUILD_WRAPPER_OUT_DIR: buildwrapper # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v3
- name: Run xcodebuild with tests
run: xcodebuild -project dev.xcodeproj/ -scheme OmiseSDK -derivedDataPath Build/ -destination 'platform=iOS Simulator,name=iPhone 11,OS=16.2' -enableCodeCoverage YES clean build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
- name: Convert Xcode coverage to SonarCloud format
run: bash xccov-to-sonarqube-generic.sh build/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml
- name: Mark build directory as deletable
run: xattr -w com.apple.xcode.CreatedByBuildSystem true ./build
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
path: sonarqube-generic-coverage.xml
retention-days: 5 # Artifact will be available only for 5 days.
# - name: Run build-wrapper
# run: |
# build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} xcodebuild clean build
#
# - name: Dump build-wrapper
# run: cat ./buildwrapper/build-wrapper-dump.json
sonar-scan:
name: Sonar scan
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository on branch
uses: actions/checkout@v3
with:
ref: ${{ github.HEAD_REF }}
fetch-depth: 0
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Run sonar-scanner
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here
with:
args: >
-Dsonar.projectVersion=${{ github.run_id }}
-Dsonar.branch.name=${{ github.ref_name }}