Skip to content

Commit 1d137be

Browse files
committed
Update CI workflows from swift-rfc-1035
1 parent 3349139 commit 1d137be

File tree

3 files changed

+63
-42
lines changed

3 files changed

+63
-42
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ jobs:
3131
uses: actions/cache@v4
3232
with:
3333
path: .build
34-
key: ${{ runner.os }}-spm-${{ hashFiles('Package.swift') }}
34+
key: macos-swift62-spm-${{ hashFiles('Package.swift', 'Package@*.swift') }}
3535
restore-keys: |
36-
${{ runner.os }}-spm-
36+
macos-swift62-spm-
3737
3838
# Note: swift test builds automatically, no separate build step needed
3939
- name: Test
@@ -42,13 +42,19 @@ jobs:
4242
- name: Validate Package.swift
4343
run: swift package dump-package
4444

45-
- name: Run README verification tests
46-
run: swift test --filter ReadmeVerificationTests
47-
4845
- name: Check for API breaking changes
46+
id: api-diff
4947
run: |
50-
swift package diagnose-api-breaking-changes \
51-
--breakage-allowlist-path .swift-api-breakage-allowlist || true
48+
echo "## API Breaking Changes Check" >> $GITHUB_STEP_SUMMARY
49+
if swift package diagnose-api-breaking-changes --breakage-allowlist-path .swift-api-breakage-allowlist 2>&1 | tee api-diff.txt; then
50+
echo "✅ No API breaking changes detected" >> $GITHUB_STEP_SUMMARY
51+
else
52+
echo "⚠️ API breaking changes detected:" >> $GITHUB_STEP_SUMMARY
53+
echo '```' >> $GITHUB_STEP_SUMMARY
54+
cat api-diff.txt >> $GITHUB_STEP_SUMMARY
55+
echo '```' >> $GITHUB_STEP_SUMMARY
56+
echo "::warning::API breaking changes detected. Review changes before release."
57+
fi
5258
continue-on-error: true
5359

5460
# Production validation: Latest Swift on Linux with release build
@@ -63,29 +69,29 @@ jobs:
6369
uses: actions/cache@v4
6470
with:
6571
path: .build
66-
key: ${{ runner.os }}-spm-${{ hashFiles('Package.swift') }}
67-
restore-keys: ${{ runner.os }}-spm-
72+
key: linux-swift62-spm-${{ hashFiles('Package.swift', 'Package@*.swift') }}
73+
restore-keys: linux-swift62-spm-
6874

6975
# Note: swift test builds automatically in release mode
7076
- name: Test (release)
7177
run: swift test -c release
7278

73-
# Compatibility check: Minimum supported Swift version (6.0)
74-
# Note: Swift Testing framework requires Swift 6.0+
79+
# Compatibility check: Minimum supported Swift version (6.2)
80+
# Update to swift:6.3 when available
7581
linux-compat:
76-
name: Ubuntu (Swift 6.0, compatibility)
82+
name: Ubuntu (Swift 6.2, compatibility)
7783
runs-on: ubuntu-latest
78-
container: swift:6.0
84+
container: swift:6.2
7985
steps:
8086
- uses: actions/checkout@v5
8187

8288
- name: Cache Swift packages
8389
uses: actions/cache@v4
8490
with:
8591
path: .build
86-
key: ${{ runner.os }}-swift60-spm-${{ hashFiles('Package.swift') }}
87-
restore-keys: ${{ runner.os }}-swift60-spm-
92+
key: linux-swift62-compat-spm-${{ hashFiles('Package.swift', 'Package@*.swift') }}
93+
restore-keys: linux-swift62-compat-spm-
8894

8995
# Note: swift test builds automatically
90-
- name: Test (Swift 6.0)
96+
- name: Test (Swift 6.2)
9197
run: swift test -c release

.github/workflows/swift-format.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55
branches:
66
- main
77

8-
concurrency:
9-
group: format-${{ github.ref }}
10-
cancel-in-progress: true
11-
128
jobs:
139
swift_format:
1410
name: swift-format
@@ -18,23 +14,18 @@ jobs:
1814
contents: write
1915
steps:
2016
- uses: actions/checkout@v5
21-
with:
22-
ref: ${{ github.head_ref || github.ref_name }}
23-
24-
- name: Configure git safe directory
25-
run: git config --global --add safe.directory /__w/swift-svg-types/swift-svg-types
2617

27-
- name: Restore swift-format cache
28-
id: cache-swift-format-restore
29-
uses: actions/cache/restore@v4
18+
- name: Cache swift-format
19+
id: cache-swift-format
20+
uses: actions/cache@v4
3021
with:
3122
path: /usr/local/bin/swift-format
32-
key: ${{ runner.os }}-swift-format-main-v1
23+
key: ${{ runner.os }}-swift-format-${{ hashFiles('.github/workflows/swift-format.yml') }}
3324

3425
- name: Install swift-format
35-
if: steps.cache-swift-format-restore.outputs.cache-hit != 'true'
26+
if: steps.cache-swift-format.outputs.cache-hit != 'true'
3627
run: |
37-
git clone --depth 1 --branch main https://github.com/apple/swift-format.git
28+
git clone --depth 1 --branch $(git ls-remote --tags https://github.com/apple/swift-format.git | grep -o 'refs/tags/[0-9]*\.[0-9]*\.[0-9]*$' | sort -V | tail -1 | sed 's/refs\/tags\///') https://github.com/apple/swift-format.git
3829
cd swift-format
3930
swift build -c release
4031
cp .build/release/swift-format /usr/local/bin/
@@ -48,10 +39,3 @@ jobs:
4839
with:
4940
commit_message: Run swift-format
5041
branch: 'main'
51-
52-
- name: Save swift-format cache
53-
uses: actions/cache/save@v4
54-
if: steps.cache-swift-format-restore.outputs.cache-hit != 'true'
55-
with:
56-
path: /usr/local/bin/swift-format
57-
key: ${{ runner.os }}-swift-format-main-v1

.github/workflows/swiftlint.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,44 @@
11
name: SwiftLint
2+
23
on:
4+
push:
5+
branches:
6+
- main
37
pull_request:
4-
branches: [main]
8+
branches:
9+
- main
510

611
jobs:
712
lint:
13+
name: SwiftLint
814
runs-on: ubuntu-latest
15+
container: swift:6.2
916
steps:
1017
- uses: actions/checkout@v5
11-
- name: SwiftLint
12-
run: swiftlint lint
13-
continue-on-error: true
18+
19+
- name: Restore swiftlint cache
20+
id: cache-swiftlint-restore
21+
uses: actions/cache/restore@v4
22+
with:
23+
path: /usr/local/bin/swiftlint
24+
key: ${{ runner.os }}-swiftlint-0.62.2
25+
26+
- name: Install swiftlint
27+
if: steps.cache-swiftlint-restore.outputs.cache-hit != 'true'
28+
run: |
29+
git clone --depth 1 --branch 0.62.2 https://github.com/realm/SwiftLint.git
30+
cd SwiftLint
31+
swift build -c release
32+
cp .build/release/swiftlint /usr/local/bin/
33+
cd ..
34+
rm -rf SwiftLint
35+
36+
- name: Lint
37+
run: swiftlint lint --strict --reporter github-actions-logging
38+
39+
- name: Save swiftlint cache
40+
uses: actions/cache/save@v4
41+
if: always() && steps.cache-swiftlint-restore.outputs.cache-hit != 'true'
42+
with:
43+
path: /usr/local/bin/swiftlint
44+
key: ${{ runner.os }}-swiftlint-0.62.2

0 commit comments

Comments
 (0)