name: Linting

on: pull_request

jobs:
  swiftformat:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: Installing packages
      run: brew update && brew install -f swiftformat
    - name: swiftformat
      run: |
         swiftformat --lint .

  swiftlint:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: Installing packages
      run: brew update && brew install -f swiftlint || brew link --overwrite swiftlint
    - name: swiftlint
      run: |
         swiftlint --strict

name: Linting

on: pull_request

jobs:
  swiftformat:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: Installing packages
      run: |
        brew update
        if brew ls --version swiftformat > /dev/null; then 
          brew upgrade swiftformat
        else
          brew install swiftformat
        fi
    - name: Formatting code
      run: |
         swiftformat --lint .

  swiftlint:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: Installing packages
      run: |
        brew update
        if brew ls --version swiftlint > /dev/null; then
          brew upgrade swiftlint
        else
          # For some reason the SwiftLint binary is kept at its location after shutdown.
          brew install swiftlint || brew link --overwrite swiftlint
        fi
    - name: Linting code
      run: |
         swiftlint --strict

Install or upgrade tools installed by Homebrew
Install or upgrade tools installed by Homebrew
