-
Notifications
You must be signed in to change notification settings - Fork 45
39 lines (31 loc) · 959 Bytes
/
lint.yml
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
name: Linter
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Lint Swift code with SwiftFormat
runs-on: macos-13-xlarge
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Read env
run: cat .github/workflows/env.properties >> $GITHUB_ENV
- name: Switch to Xcode ${{ env.xcode_version }}
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app
- name: Cache SPM build
uses: actions/cache@v2
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Run SwiftFormat
run: |
swift run -c release swiftformat --lint .
- name: Report error
if: ${{ failure() }}
run: |
echo '::error::SwiftFormat linting failed. Run `Scripts/swiftformat` to format your code.'