feat: [FC-0072] setup linting on ci/cd #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SwiftLint | |
on: | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: macos-latest | |
concurrency: | |
group: ${{ github.ref == 'refs/heads/develop' && format('swiftlint-develop-{0}', github.sha) || format('swiftlint-{0}', github.ref) }} | |
cancel-in-progress: true | |
steps: | |
- uses: nschloe/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/cache@v3 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Setup environment | |
run: | | |
source ci_scripts/ci_prepare_env.sh && setup_github_actions_environment | |
xcodes select 16.1 | |
- name: Install pods | |
run: | | |
pod install | |
- name: SwiftLint | |
run: | | |
export PODS_ROOT=$(pwd)/Pods | |
"${PODS_ROOT}/SwiftLint/swiftlint" --reporter sarif > swiftlint.report.sarif | |
- name: Prepare swiftlint.report.sarif | |
if: success() || failure() | |
run: | | |
swift PrepareSarifToUpload.swift | |
- name: Upload report | |
uses: github/codeql-action/upload-sarif@v3 | |
if: success() || failure() | |
with: | |
sarif_file: swiftlint.report.sarif |