action-swiftlint icon indicating copy to clipboard operation
action-swiftlint copied to clipboard

Support running on macos runners

Open BrentMifsud opened this issue 3 years ago • 4 comments

Title is pretty self explanatory.

We have our own macos build machine that we hooked up to be a runner (so we dont have to pay for github actions).

It would be nice to be able to run this workflow on a mac machine.

BrentMifsud avatar Feb 18 '22 17:02 BrentMifsud

+1 - I would love to use it on macOS as well

grzegorzkrukowski avatar Feb 24 '22 23:02 grzegorzkrukowski

yes please!

landsman avatar Apr 26 '23 07:04 landsman

I have the same request. In the meantime this little workflow gets the job done by running swiftlint only on changed files on our self hosted macOS runner.

name: Linter - SwiftLint

on:
  pull_request:
    types: [opened, synchronize, reopened]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  swift_format:
    name: lint
    runs-on: [self-hosted, iOS]

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Fetch all history for all branches and tags

      - name: Run swiftlint
        run: |
          echo ""
          echo "🏃‍♂️ Running swiftlint on modified files 🤵‍♂️"

          git diff --name-status origin/main          \
            | grep -E "^A|^M" | sed "s/^[AM]\t//g"    \
            | grep -E "\.swift\$$"                    \
            || echo "No files added nor modified!"

          git diff --name-status origin/main          \
            | grep -E "^A|^M" | sed "s/^[AM]\t//g"    \
            | grep -E "\.swift\$$"                    \
            | xargs --no-run-if-empty swiftlint lint --quiet --strict --reporter github-actions-logging

ladislas avatar May 17 '23 08:05 ladislas

Everyone interested, please checkout "SwiftLint Annotations" Action which doesn't use Docker and natively runs swiftlint binary.

fkorotkov avatar May 17 '24 15:05 fkorotkov