Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinned swiftlint version support #25

Open
esteluk opened this issue Feb 11, 2020 · 3 comments
Open

Pinned swiftlint version support #25

esteluk opened this issue Feb 11, 2020 · 3 comments

Comments

@esteluk
Copy link

esteluk commented Feb 11, 2020

Hey, when our .swiftlint.yml specifies a specific swiftlint_version to lint our project with, it causes our builds to start to fail when the Action starts using a more recent version of Swiftlint.

Happy to look into it myself, but is there a way to pin the Swiftlint version that the action (or Docker image) are using? Or was it an explicit decision to track the latest release?

@norio-nomura
Copy link
Owner

norio-nomura commented Feb 11, 2020

As long as action-swiftlint uses the Docker image norionomura/swiftlint, it would be difficult to pin the version of swiftlint. 🤔
In order to realize that, I think it is necessary to rewrite everything in node.js, actions takes the version of SwiftLint to use, download that version from GitHub Release and execute it on macOS.
If I do that, I'd use another repository.

@esteluk
Copy link
Author

esteluk commented Feb 11, 2020

Okay, thanks :) Yeah I looked at the Docker image and it looked... non-trivial. Might take a look at what the right solution is for us - it might just be to unpin the version.

@norio-nomura
Copy link
Owner

If your workflow does not depend on DIFF_BASE feature implemented on #22, it can use the Docker image norionomura/swiftlint with version tag instead of action-swiftlint:

name: SwiftLint

on:
  pull_request:
    paths:
      - '.github/workflows/swiftlint.yml'
      - '.swiftlint.yml'
      - '**/*.swift'

jobs:
  SwiftLint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: SwiftLint
        uses: docker://norionomura/swiftlint:0.38.1
        with:
          args: swiftlint --reporter github-actions-logging

--reporter github-actions-logging option exists on SwiftLint 0.37.0 or later.

🤔

But if you want to use above, you might prefer to install swiftlint using Homebrew on macOS instead:

name: SwiftLint on macOS

on:
  pull_request:
    paths:
      - '.github/workflows/swiftlint-macos.yml'
      - '.swiftlint.yml'
      - '**/*.swift'

jobs:
  SwiftLint:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v1
      - name: Install SwiftLint 0.38.2
        env:
          HOMEBREW_NO_AUTO_UPDATE: 1 
        run: brew install https://raw.github.com/Homebrew/homebrew-core/203436f8567a3b6455264a1d896da5b1df1e50e6/Formula/swiftlint.rb
      - name: Run SwiftLint
        run: swiftlint lint --reporter github-actions-logging

The commit hash on hombrew-core can be found like following:

$ GIT_DIR=$(brew --repo homebrew/homebrew-core)/.git git --no-pager log master --grep=bottle --max-count 5 -- Formula/swiftlint.rb
commit b351d462bb8cbd8610f67dd433e9ab4593f3cfa6
Author: BrewTestBot <[email protected]>
Date:   Tue Feb 11 06:54:20 2020 +0000

    swiftlint: update 0.39.0 bottle.

commit 203436f8567a3b6455264a1d896da5b1df1e50e6
Author: BrewTestBot <[email protected]>
Date:   Wed Jan 8 21:55:28 2020 +0000

    swiftlint: update 0.38.2 bottle.

commit 0cfa1c726ca0ceb30cd5f0d370908963614da08d
Author: BrewTestBot <[email protected]>
Date:   Sat Jan 4 03:55:14 2020 +0000

    swiftlint: update 0.38.1 bottle.

commit b9ec4363fd9ddcdf912a8ac182dce8cb524a9d1d
Author: BrewTestBot <[email protected]>
Date:   Tue Dec 3 22:39:08 2019 +0000

    swiftlint: update 0.38.0 bottle.

commit c20187b22b1b6b550377d57c1fc8bcd9406b5502
Author: BrewTestBot <[email protected]>
Date:   Sat Nov 9 23:59:58 2019 +0000

    swiftlint: update 0.37.0 bottle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants