Skip to content

Commit 56adc1b

Browse files
committed
Add the option to lint code with SwiftLint before builds
1 parent 1a81a61 commit 56adc1b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ on:
2929
type: string
3030
required: true
3131
description: "Tarball Checksum for the static Linux SDK."
32+
run-swiftlint:
33+
type: boolean
34+
required: false
35+
default: false
36+
description: "If true, the workflow will run SwiftLint before building. Make sure you have the SwiftLint command tool plugin installed!"
3237

3338
concurrency:
3439
group: ${{ github.workflow }}-${{ github.ref }}
@@ -67,6 +72,10 @@ jobs:
6772
with:
6873
swift-version: "${{ env.SWIFT_TOOLCHAIN_VERSION }}"
6974

75+
- name: Linting code with SwiftLint.
76+
if: ${{ inputs.run-swiftlint }}
77+
run: swift package plugin --allow-writing-to-package-directory swiftlint lint --progress
78+
7079
- name: Installing the static Swift SDK for Linux.
7180
run: swift sdk install $LINUX_SDK_URL --checksum $LINUX_SDK_CHECKSUM
7281

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ on:
3636
type: string
3737
required: true
3838
description: "Tarball Checksum for the static Linux SDK."
39+
run-swiftlint:
40+
type: boolean
41+
required: false
42+
default: false
43+
description: "If true, the workflow will run SwiftLint before building. Make sure you have the SwiftLint command tool plugin installed!"
3944

4045
concurrency:
4146
group: ${{ github.workflow }}-${{ github.ref }}
@@ -75,6 +80,10 @@ jobs:
7580
uses: swift-actions/setup-swift@96e1dd40c7aa863eafac5979fd597972980a64c7
7681
with:
7782
swift-version: "${{ env.SWIFT_TOOLCHAIN_VERSION }}"
83+
84+
- name: Linting code with SwiftLint.
85+
if: ${{ inputs.run-swiftlint }}
86+
run: swift package plugin --allow-writing-to-package-directory swiftlint lint --progress
7887

7988
- name: Installing the static Swift SDK for Linux.
8089
run: swift sdk install $LINUX_SDK_URL --checksum $LINUX_SDK_CHECKSUM

0 commit comments

Comments
 (0)