-
Notifications
You must be signed in to change notification settings - Fork 12
142 lines (122 loc) · 4.25 KB
/
swift-ci.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Swift CI
on:
schedule:
- cron: '0 0 * * *'
push:
branches: [ '*' ]
paths-ignore:
- '**.md'
tags: [ '[0-9]+.[0-9]+.[0-9]+' ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app
jobs:
test-ios:
runs-on: macos-14
strategy:
matrix:
include:
- destination: platform=iOS Simulator,name=iPhone 8
platform: iphone
- destination: platform=tvOS Simulator,name=Apple TV
platform: appletv
- destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm)
platform: watch
- destination: platform=visionOS Simulator,name=Apple Vision Pro
platform: watch
steps:
- uses: actions/checkout@v4
- name: Tests
run: |
set -o pipefail
xcodebuild build-for-testing -project ConfigCat.xcodeproj -scheme "ConfigCat" -destination "${{ matrix.destination }}" CODE_SIGNING_REQUIRED=NO -quiet
xcodebuild test-without-building -project ConfigCat.xcodeproj -scheme "ConfigCat" -destination "${{ matrix.destination }}" CODE_SIGNING_REQUIRED=NO -resultBundlePath tests/${{ matrix.platform }}.xcresult
- name: Archive results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results
path: tests
test-osx:
runs-on: macos-14
strategy:
matrix:
include:
- sdk: macosx14.5
destination: arch=x86_64
platform: macos
steps:
- uses: actions/checkout@v4
- name: Tests
run: |
set -o pipefail
xcodebuild build-for-testing -sdk ${{ matrix.sdk }} -project ConfigCat.xcodeproj -scheme "ConfigCat" -destination "${{ matrix.destination }}" -quiet
xcodebuild test-without-building -sdk ${{ matrix.sdk }} -project ConfigCat.xcodeproj -scheme "ConfigCat" -destination "${{ matrix.destination }}" -resultBundlePath tests/${{ matrix.platform }}.xcresult
- name: Archive results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results
path: tests
coverage:
needs: [test-ios, test-osx]
runs-on: macos-14
strategy:
matrix:
include:
- sdk: macosx14.5
destination: arch=x86_64
steps:
- uses: actions/checkout@v4
- name: Install Slather
run: |
gem install slather
brew install sonar-scanner
- name: Execute Coverage
run: |
set -o pipefail
xcodebuild build-for-testing -sdk ${{ matrix.sdk }} -project ConfigCat.xcodeproj -scheme "ConfigCat Coverage" -destination "${{ matrix.destination }}" -quiet
xcodebuild test-without-building -sdk ${{ matrix.sdk }} -project ConfigCat.xcodeproj -scheme "ConfigCat Coverage" -destination "${{ matrix.destination }}" -quiet
slather
- name: Run Sonar
run: |
git fetch --unshallow --no-tags
sonar-scanner -Dsonar.token=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pod-lint:
needs: coverage
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install Cocoapods
run: gem install cocoapods
- name: Enable VisionOS
run: |
defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES
defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES
xcodebuild -downloadPlatform visionOS
- name: Lint
run: pod lib lint
publish:
needs: pod-lint
runs-on: macos-14
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: Install Cocoapods
run: gem install cocoapods
- name: Publish
run: pod trunk push
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
# Prevent GitHub from suspending your cronjob based triggers due to repository inactivity
keepalive:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- uses: gautamkrishnar/keepalive-workflow@v2