-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 1.94 KB
/
Copy pathcode-style.yml
File metadata and controls
57 lines (50 loc) · 1.94 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
name: code-style
# Trial of the ecosystem's code-style policy (OCCTSwiftScripts#114); see
# docs/code-style-policy-proposal-2026-08.md in the `ecosystem` repo for the
# full rationale. Chosen as the pilot repo because it's small enough to fully
# sweep into compliance in one PR and go straight to a blocking gate, rather
# than needing OCCTSwift's gradual "if you touch it, you fix it" exemption
# manifest.
#
# Pure text analysis (formatting + lint), no compiled output needed by any of
# the three checks, so this stays a macOS runner only because that's where
# swift-format and swiftlint are both readily available via Homebrew — same
# reasoning `verbs.yml`/`recipes.yml` use for needing macOS at all, minus the
# `swift build` step they need and this workflow doesn't.
#
# swift-format and SwiftLint are blocking: formatting has no judgment call in
# it. The comment-ratio check is report-only by design (see the script's own
# header) and is not a gate; it always exits 0.
on:
push:
paths:
- 'Sources/**'
- 'Tests/**'
- '.swift-format'
- '.swiftlint.yml'
- 'Scripts/comment-ratio-check.sh'
- '.github/workflows/code-style.yml'
pull_request:
paths:
- 'Sources/**'
- 'Tests/**'
- '.swift-format'
- '.swiftlint.yml'
- 'Scripts/comment-ratio-check.sh'
- '.github/workflows/code-style.yml'
workflow_dispatch:
jobs:
code-style:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Install swift-format and SwiftLint
run: brew install swift-format swiftlint
- name: swift-format lint --strict
run: |
find Sources Tests -name '*.swift' -print0 \
| xargs -0 swift-format lint --strict --configuration .swift-format
- name: swiftlint lint --strict
run: swiftlint lint --strict --config .swiftlint.yml
- name: Comment:code ratio (report-only, never fails)
run: Scripts/comment-ratio-check.sh