Skip to content

Commit 1daad51

Browse files
committed
Apply CI standard: optimize workflows
1 parent 0d3305f commit 1daad51

File tree

3 files changed

+72
-69
lines changed

3 files changed

+72
-69
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,91 @@
11
name: CI
2+
23
on:
34
push:
4-
branches: [main]
5+
branches:
6+
- main
57
pull_request:
6-
branches: [main]
8+
branches:
9+
- main
710
workflow_dispatch:
811

912
concurrency:
1013
group: ci-${{ github.ref }}
1114
cancel-in-progress: true
1215

1316
jobs:
14-
macos-swift59:
15-
name: macOS (Swift 5.9)
17+
# Primary development workflow: Latest Swift on macOS with debug build
18+
macos-latest:
19+
name: macOS (Swift 6.2, debug)
1620
runs-on: macos-26
17-
strategy:
18-
matrix:
19-
xcode: ['26.0']
20-
config: ['debug', 'release']
2121
steps:
2222
- uses: actions/checkout@v5
23-
- name: Select Xcode ${{ matrix.xcode }}
24-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
23+
24+
- name: Select Xcode 26.0
25+
run: sudo xcode-select -s /Applications/Xcode_26.0.app
26+
2527
- name: Print Swift version
2628
run: swift --version
29+
2730
- name: Cache Swift packages
2831
uses: actions/cache@v4
2932
with:
3033
path: .build
31-
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
32-
restore-keys: ${{ runner.os }}-spm-
33-
- name: Build
34-
run: swift build -c ${{ matrix.config }}
35-
- name: Run tests
36-
run: swift test -c ${{ matrix.config }}
34+
key: ${{ runner.os }}-spm-${{ hashFiles('Package.swift') }}
35+
restore-keys: |
36+
${{ runner.os }}-spm-
3737
38-
macos-swift62:
39-
name: macOS (Swift 6.2)
40-
runs-on: macos-26
41-
strategy:
42-
matrix:
43-
xcode: ['26.0']
44-
config: ['debug', 'release']
38+
# Note: swift test builds automatically, no separate build step needed
39+
- name: Test
40+
run: swift test -c debug
41+
42+
- name: Validate Package.swift
43+
run: swift package dump-package
44+
45+
- name: Run README verification tests
46+
run: swift test --filter ReadmeVerificationTests
47+
48+
- name: Check for API breaking changes
49+
run: |
50+
swift package diagnose-api-breaking-changes \
51+
--breakage-allowlist-path .swift-api-breakage-allowlist || true
52+
continue-on-error: true
53+
54+
# Production validation: Latest Swift on Linux with release build
55+
linux-latest:
56+
name: Ubuntu (Swift 6.2, release)
57+
runs-on: ubuntu-latest
58+
container: swift:6.2
4559
steps:
4660
- uses: actions/checkout@v5
47-
- name: Select Xcode ${{ matrix.xcode }}
48-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
49-
- name: Print Swift version
50-
run: swift --version
61+
5162
- name: Cache Swift packages
5263
uses: actions/cache@v4
5364
with:
5465
path: .build
55-
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
66+
key: ${{ runner.os }}-spm-${{ hashFiles('Package.swift') }}
5667
restore-keys: ${{ runner.os }}-spm-
57-
- name: Build
58-
run: swift build -c ${{ matrix.config }}
59-
- name: Run tests
60-
run: swift test -c ${{ matrix.config }}
6168

62-
linux-swift62:
63-
name: Ubuntu (Swift 6.2)
69+
# Note: swift test builds automatically in release mode
70+
- name: Test (release)
71+
run: swift test -c release
72+
73+
# Compatibility check: Minimum supported Swift version (6.0)
74+
# Note: Swift Testing framework requires Swift 6.0+
75+
linux-compat:
76+
name: Ubuntu (Swift 6.0, compatibility)
6477
runs-on: ubuntu-latest
65-
container: swift:6.2
78+
container: swift:6.0
6679
steps:
6780
- uses: actions/checkout@v5
81+
6882
- name: Cache Swift packages
6983
uses: actions/cache@v4
7084
with:
7185
path: .build
72-
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
73-
restore-keys: ${{ runner.os }}-spm-
74-
- name: Build
75-
run: swift build
76-
- name: Run tests
77-
run: swift test
86+
key: ${{ runner.os }}-swift60-spm-${{ hashFiles('Package.swift') }}
87+
restore-keys: ${{ runner.os }}-swift60-spm-
7888

79-
readme-validation:
80-
name: README Code Examples
81-
runs-on: macos-26
82-
steps:
83-
- uses: actions/checkout@v5
84-
- name: Select Xcode
85-
run: sudo xcode-select -s /Applications/Xcode_26.0.app
86-
- name: Run README verification tests
87-
run: swift test --filter ReadmeVerificationTests
89+
# Note: swift test builds automatically
90+
- name: Test (Swift 6.0)
91+
run: swift test -c release

.github/workflows/swift-format.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,21 @@ jobs:
1818
contents: write
1919
steps:
2020
- 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-html-css-pointfree/swift-html-css-pointfree
2126

22-
- name: Cache swift-format
23-
id: cache-swift-format
24-
uses: actions/cache@v4
27+
- name: Restore swift-format cache
28+
id: cache-swift-format-restore
29+
uses: actions/cache/restore@v4
2530
with:
2631
path: /usr/local/bin/swift-format
27-
key: ${{ runner.os }}-swift-format-${{ hashFiles('.github/workflows/swift-format.yml') }}
32+
key: ${{ runner.os }}-swift-format-main-v1
2833

2934
- name: Install swift-format
30-
if: steps.cache-swift-format.outputs.cache-hit != 'true'
35+
if: steps.cache-swift-format-restore.outputs.cache-hit != 'true'
3136
run: |
3237
git clone --depth 1 --branch main https://github.com/apple/swift-format.git
3338
cd swift-format
@@ -37,9 +42,16 @@ jobs:
3742
rm -rf swift-format
3843
3944
- name: Format
40-
run: swift-format format --ignore-unparsable-files --recursive --in-place Sources Tests
45+
run: swift-format format --recursive --in-place --ignore-unparsable-files Sources Tests
4146

4247
- uses: stefanzweifel/git-auto-commit-action@v7
4348
with:
4449
commit_message: Run swift-format
4550
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: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)