Improved renaming flow #3
This file contains hidden or 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: Linting | |
| on: | |
| pull_request: | |
| # Running on main ensures a cache is available for PRs to reuse | |
| push: | |
| branches: | |
| - main | |
| # GitHub Action cannot handle this if this workflow is required | |
| # paths: | |
| # - '.github/workflows/linting.yml' | |
| # - '.swiftformat' | |
| # - '.swiftlint.yml' | |
| # - '**/*.swift' | |
| jobs: | |
| SwiftLint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Read version from Mintfile | |
| run: echo "SWIFTLINT_VERSION=$(awk '/SwiftLint/ {split($0, a, "@"); print a[2]}' Mintfile)" >> $GITHUB_ENV | |
| - uses: actions/cache@v4 | |
| with: | |
| path: .build/release/swiftlint | |
| key: ${{ runner.os }}-linting-swiftlint-${{ env.SWIFTLINT_VERSION }} | |
| - name: Build realm/SwiftLint | |
| run: | | |
| if [ -f ".build/release/swiftlint" ]; then | |
| sudo cp -f .build/release/swiftlint /usr/local/bin/swiftlint | |
| else | |
| git clone --depth 1 --branch ${{ env.SWIFTLINT_VERSION }} https://github.com/realm/SwiftLint | |
| cd SwiftLint | |
| swift build --disable-sandbox -c release | |
| mv .build .. && cd .. | |
| rm -rf SwiftLint | |
| sudo cp -f .build/release/swiftlint /usr/local/bin/swiftlint | |
| fi | |
| - name: SwiftLint | |
| run: | | |
| swiftlint --version | |
| swiftlint lint --strict --config .swiftlint.yml --quiet | |
| env: | |
| LINUX_SOURCEKIT_LIB_PATH: /usr/share/swift/usr/lib # FIXED: Fatal error: Loading libsourcekitdInProc.so failed | |
| SwiftFormat: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Read version from Mintfile | |
| run: echo "SWIFTFORMAT_VERSION=$(awk '/SwiftFormat/ {split($0, a, "@"); print a[2]}' Mintfile)" >> $GITHUB_ENV | |
| - uses: actions/cache@v4 | |
| with: | |
| path: .build/release/swiftformat | |
| key: ${{ runner.os }}-linting-swiftformat-${{ env.SWIFTFORMAT_VERSION }} | |
| - name: Build nicklockwood/SwiftFormat | |
| run: | | |
| if [ -f ".build/release/swiftformat" ]; then | |
| if ! [ -x "$(command -v swift-format)" ]; then | |
| sudo cp -f .build/release/swiftformat /usr/local/bin/swiftformat | |
| fi | |
| else | |
| git clone --depth 1 --branch ${{ env.SWIFTFORMAT_VERSION }} https://github.com/nicklockwood/SwiftFormat | |
| cd SwiftFormat | |
| swift build --disable-sandbox -c release | |
| mv .build .. && cd .. | |
| rm -rf SwiftFormat | |
| sudo cp -f .build/release/swiftformat /usr/local/bin/swiftformat | |
| fi | |
| - name: SwiftFormat | |
| run: | | |
| swiftformat --version | |
| swiftformat . --config .swiftformat --lint |