项目作者: Cyberbeni

项目描述 :
GitHub Action to build and cache any Swift based tool in workflows.
高级语言: TypeScript
项目地址: git://github.com/Cyberbeni/install-swift-tool.git
创建时间: 2019-11-26T22:33:18Z
项目社区:https://github.com/Cyberbeni/install-swift-tool

开源协议:MIT License

下载


Description

Github action to install swift based tools, like xcbeautify or swiftformat, to be used inside workflows.

Versions

master - It should always work and contain the latest changes.

v1 - Initial version. Deprecated, use v2 with use-cache: false instead.

v2 - Adds caching (enabled by default), allows specifying commit or version. Deprecated, use v3, set branch manually if you want to use the default branch and set LINUX_SOURCEKIT_LIB_PATH manually if needed (not needed with the official runner images for more than 2 years).

v3 - Uses the Package.resolved file if no commit/branch/version is specified.

Usage

Step example:

  1. - name: Install xcbeautify
  2. uses: Cyberbeni/install-swift-tool@v3
  3. with:
  4. url: https://github.com/nicklockwood/SwiftFormat
  5. # Version from Package.resolved is used if no commit/branch/version is provided.
  6. commit: '175df295d77b5bf255b0c160d380cabbe826ded4' # optional, commit hash
  7. branch: develop # optional, branch or tag, overridden by commit/version
  8. version: '*' # optional, overridden by commit, format: https://devhints.io/semver
  9. package-resolved-path: 'Package.resolved' # optional, default: 'Package.resolved', Package.resolved file path to use for resolving the version if no commit/branch/version is specified
  10. use-cache: true # optinal, default: true

Workflow example:

  1. name: Lint
  2. on:
  3. pull_request:
  4. push:
  5. branches: master # https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
  6. jobs:
  7. swiftformat-lint:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v4
  12. - name: Install SwiftFormat
  13. uses: Cyberbeni/install-swift-tool@v3
  14. with:
  15. url: https://github.com/nicklockwood/SwiftFormat
  16. - name: Lint
  17. run: swiftformat --lint .

How to contribute

Install Node.js: https://nodejs.org/en/download/package-manager

Install yarn and download the dependencies

  1. npm install --global yarn
  2. yarn

Run before commit (fix any issues manually that formatting can’t automatically fix)

  1. npm run format
  2. npm run build

Run unit tests in ./tests (the e2e tests are run on GitHub after push/pull request)

  1. npm run test