-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (36 loc) · 1.42 KB
/
swift.yml
File metadata and controls
46 lines (36 loc) · 1.42 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
# 库仓 CI:静态检查 + SPM 构建烟囱测试。
# Example 全量单测 / UI 测在同仓 `.github/workflows/example-tests.yml`(根目录 `STBaseProject.xcworkspace`)。
name: Swift
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: macos-15
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
# 默认 xcode-select 常为旧版;脚本按 Info.plist 版本号选 /Applications 下最高的 Xcode(见 .github/select_xcode_ci.sh)。
- name: Select Xcode
run: bash "${GITHUB_WORKSPACE}/.github/select_xcode_ci.sh"
- name: Check try? policy
run: bash .github/check_try_question_mark.sh
- name: SwiftLint
run: |
if ! command -v swiftlint >/dev/null 2>&1; then
brew install swiftlint
fi
swiftlint version
# 不加 --strict:warning 不阻断 CI,仅 .swiftlint.yml 中明确为 error 级别的规则会失败构建。
# 待存量 warning 清零后可改为 --strict 提升门槛。
swiftlint --reporter github-actions-logging
- name: Resolve SPM dependencies
run: xcodebuild -resolvePackageDependencies -scheme STBaseProject-Package
- name: Build (iOS Simulator)
run: |
xcodebuild \
-scheme STBaseProject-Package \
-destination 'generic/platform=iOS Simulator' \
build