Created
April 5, 2020 19:42
-
-
Save ydnar/17da5a1a3941d7674bad4a2548c38e95 to your computer and use it in GitHub Desktop.
SwiftFormat with GitHub Actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Swift | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/swift.yaml" | |
- "**.swift" | |
- "**/Package.resolved" | |
pull_request: | |
paths: | |
- ".github/workflows/swift.yaml" | |
- "**.swift" | |
- "**/Package.resolved" | |
jobs: | |
swiftformat: | |
name: Check swiftformat | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Update PATH | |
run: echo ::add-path::$HOME/bin | |
- name: Cache packages/Tools/.build | |
uses: actions/cache@v1 | |
with: | |
path: packages/Tools/.build | |
key: ${{ runner.os }}-swift-tools-build-${{ hashFiles('packages/Tools/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-swift-tools-build- | |
- name: Cache ~/bin | |
uses: actions/cache@v1 | |
with: | |
path: ~/bin | |
key: ${{ runner.os }}-home-bin-${{ hashFiles('packages/Tools/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-home-bin- | |
- name: Install Swift tools | |
run: make swift-tools | |
- name: Format Swift code | |
run: swiftformat --verbose . | |
- name: Verify formatted code is unchanged | |
run: git diff --exit-code HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment