Last active
September 7, 2022 13:18
-
-
Save ghiculescu/ad03483060110fee944791ecd31496f2 to your computer and use it in GitHub Desktop.
Github Actions CI steps for Turbo Android and Turbo iOS apps
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: ktlint | |
on: [pull_request] | |
jobs: | |
ktlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: ktlint | |
uses: ScaCap/action-ktlint@master | |
with: | |
github_token: ${{ secrets.github_token }} | |
reporter: github-pr-check | |
fail_on_error: true | |
android: true |
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: [pull_request] | |
jobs: | |
SwiftLint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Run swiftlint | |
uses: norio-nomura/[email protected] |
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: Test | |
on: [pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Test with Gradle | |
run: ./gradlew testDebug --info |
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: Tests | |
on: [pull_request] | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run tests | |
run: xcodebuild clean test -workspace "work-ios.xcworkspace" -scheme "work-ios" -destination "platform=iOS Simulator,name=iPhone 12 Pro,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} |
Ohh, very nice! Thanks for this.
Can you add or document instructions on how to lint locally before submitting a PR?
I usually just let CI handle it, but...
iOS:
Pods/SwiftLint/swiftlint lint --fix
Android:
ktlint --android
So you would need swiftlint installed via CocoaPods? Is it not available be SPM?
Also, is swiftlint the go-to standard? I thought Apple had their own listing tool now. I've also been using SwiftFormat.
TIL about SwiftFormat. tbh I don't have a strong preference on linter. I just like having one. And yeah, I prefer Cocoapods over SPM but it should work either way.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jayohms @joemasilotti is there anything you'd add to these?