From 0c231eb536b014911e2cf636aa82df0dc7e2612a Mon Sep 17 00:00:00 2001 From: Jamil Date: Sat, 15 Mar 2025 22:09:56 -0500 Subject: [PATCH] ci: Explicitly run swiftlint (#8447) ~~Apparently `xcodebuild` doesn't bubble these up from CLI invocations.~~ The `swiftlint` CLI binary isn't installed on the GitHub runners, so we need to install it. This PR also explicitly runs `swiftlint` before any build operations to display a nicer diff if files were changed as a result of the fixing. --- .github/workflows/_swift.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/_swift.yml b/.github/workflows/_swift.yml index 8cfa8ce08..f07d0ecf8 100644 --- a/.github/workflows/_swift.yml +++ b/.github/workflows/_swift.yml @@ -69,6 +69,20 @@ jobs: with: path: ~/Library/Developer/Xcode/DerivedData key: ${{ runner.os }}-${{ hashFiles('swift/*', 'rust/**/*.rs', 'rust/**/*.toml', 'rust/**/*.lock}') }} + - name: swiftlint + run: | + # The binary is not installed by default + brew install swiftlint + + cd swift/apple + swiftlint --autocorrect + swiftlint --strict + + if [ ! -z "$(git status --porcelain)" ]; then + echo 'swiftlint corrected files!' + git diff + exit 1 + fi - run: ${{ matrix.build-script }} env: IOS_APP_PROVISIONING_PROFILE: "${{ secrets.APPLE_IOS_APP_PROVISIONING_PROFILE }}"