Skip to content

Commit a31c3c0

Browse files
committed
fix: standardize SwiftLint workflow with proper container and caching
Replaced minimal SwiftLint workflow with proper implementation that: - Uses Swift 6.2 container for consistency - Builds SwiftLint from source (not relying on preinstalled version) - Implements caching for faster runs (~30s vs 11m) - Runs on both push and PR (not just PR) - Uses --strict flag (fails on warnings) - Removes continue-on-error (failures should block merges) - Adds concurrency group to cancel outdated runs Matches swift-html-to-pdf configuration.
1 parent 654cca5 commit a31c3c0

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

.github/workflows/swiftlint.yml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,48 @@
11
name: SwiftLint
2+
23
on:
4+
push:
5+
branches:
6+
- main
37
pull_request:
4-
branches: [main]
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: swiftlint-${{ github.ref }}
13+
cancel-in-progress: true
514

615
jobs:
716
lint:
17+
name: SwiftLint
818
runs-on: ubuntu-latest
19+
container: swift:6.2
920
steps:
1021
- uses: actions/checkout@v5
11-
- name: SwiftLint
12-
run: swiftlint lint
13-
continue-on-error: true
22+
23+
- name: Restore swiftlint cache
24+
id: cache-swiftlint-restore
25+
uses: actions/cache/restore@v4
26+
with:
27+
path: /usr/local/bin/swiftlint
28+
key: ${{ runner.os }}-swiftlint-v1
29+
30+
- name: Install swiftlint
31+
if: steps.cache-swiftlint-restore.outputs.cache-hit != 'true'
32+
run: |
33+
git clone --depth 1 --branch main https://github.com/realm/SwiftLint.git
34+
cd SwiftLint
35+
swift build -c release
36+
cp .build/release/swiftlint /usr/local/bin/
37+
cd ..
38+
rm -rf SwiftLint
39+
40+
- name: Lint
41+
run: swiftlint lint --strict --reporter github-actions-logging
42+
43+
- name: Save swiftlint cache
44+
uses: actions/cache/save@v4
45+
if: steps.cache-swiftlint-restore.outputs.cache-hit != 'true'
46+
with:
47+
path: /usr/local/bin/swiftlint
48+
key: ${{ runner.os }}-swiftlint-v1

0 commit comments

Comments
 (0)