-
Notifications
You must be signed in to change notification settings - Fork 48
184 lines (158 loc) · 4.82 KB
/
Copy pathtest.yml
File metadata and controls
184 lines (158 loc) · 4.82 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# macOS tests with all Apple platforms
test-apple-platforms:
name: Test Apple Platforms
runs-on: macos-15
strategy:
fail-fast: false
matrix:
platform: [macOS, iOS, tvOS, watchOS]
include:
- platform: macOS
destination: 'platform=macOS'
sdk: macosx
- platform: iOS
destination: 'platform=iOS Simulator,name=iPhone 16,OS=latest'
sdk: iphonesimulator
- platform: tvOS
destination: 'platform=tvOS Simulator,name=Apple TV,OS=latest'
sdk: appletvsimulator
- platform: watchOS
destination: 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=latest'
sdk: watchsimulator
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Cache Swift Package Manager
uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Test ${{ matrix.platform }}
run: |
set -o pipefail
xcodebuild test \
-scheme Tachikoma \
-sdk ${{ matrix.sdk }} \
-destination '${{ matrix.destination }}' \
-enableCodeCoverage YES \
-derivedDataPath .build/DerivedData \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO | xcpretty
- name: Upload coverage reports
if: matrix.platform == 'macOS'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: .build/DerivedData/Logs/Test/*.xcresult
# Linux tests
test-linux:
name: Test Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
swift-version: ['6.0', '5.10']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ matrix.swift-version }}
- name: Cache Swift Package Manager
uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ matrix.swift-version }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ matrix.swift-version }}-
${{ runner.os }}-spm-
- name: Build
run: swift build --verbose
- name: Test
run: swift test --verbose --parallel
# Windows tests
test-windows:
name: Test Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
swift-version: ['6.0', '5.10']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Swift
uses: compnerd/gha-setup-swift@main
with:
branch: swift-${{ matrix.swift-version }}-release
tag: ${{ matrix.swift-version }}-RELEASE
- name: Cache Swift Package Manager
uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ matrix.swift-version }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-${{ matrix.swift-version }}-
${{ runner.os }}-spm-
- name: Build
run: swift build --verbose
shell: cmd
- name: Test
run: swift test --verbose --parallel
shell: cmd
# Package validation
validate-package:
name: Validate Swift Package
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Validate Package
run: |
swift package diagnose-api-breaking-changes baseline
swift package compute-checksum
swift package dump-package
# Integration tests with real APIs (optional, requires secrets)
integration-tests:
name: Integration Tests
runs-on: macos-15
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Run Integration Tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
if [[ -n "$OPENAI_API_KEY" && -n "$ANTHROPIC_API_KEY" ]]; then
swift test --filter IntegrationTests
else
echo "Skipping integration tests - API keys not available"
fi