Skip to content

Commit

Permalink
Merge branch 'main' into levi/manual-deploy-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
levibostian committed Sep 25, 2023
2 parents 265c0d7 + 8b9f02a commit cc48b58
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 60 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup Android
description: Setup CI with Android development tools to compile and test Android source code.

runs:
using: "composite"
steps:
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Install Android SDK
uses: android-actions/setup-android@v3

- name: Verify gradle scripts are valid gradle scripts
uses: gradle/wrapper-validation-action@v1

- name: Setup Gradle and cache dependencies between builds
uses: gradle/gradle-build-action@v2
9 changes: 2 additions & 7 deletions .github/workflows/binary-validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- uses: ./.github/actions/setup-android
- name: API check
run: ./gradlew apiCheck

run: ./gradlew apiCheck
16 changes: 1 addition & 15 deletions .github/workflows/build-sample-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,12 @@ jobs:
name: Building app...${{ matrix.sample-app }}
steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- uses: ./.github/actions/setup-android

# CLI to replace strings in files. The CLI recommends using `cargo install` which is slow. This Action is fast because it downloads pre-built binaries.
# If using sd on macos, "brew install" works great. for Linux, this is the recommended way.
- name: Install sd CLI to use later in the workflow
uses: kenji-miyake/setup-sd@v1

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Install tools from Gemfile (ruby language) used for building our apps with
uses: ruby/setup-ruby@v1
Expand All @@ -95,12 +87,6 @@ jobs:
touch "samples/local.properties"
echo "siteId=${{ secrets[matrix.cio-siteid-secret-key] }}" >> "samples/local.properties"
echo "apiKey=${{ secrets[matrix.cio-apikey-secret-key] }}" >> "samples/local.properties"
- name: Verify gradle scripts are not modified
uses: gradle/wrapper-validation-action@v1

- name: Setup Gradle and cache dependencies between builds
uses: gradle/gradle-build-action@v2
- name: Dump GitHub Action metadata because Fastlane uses it. Viewing it here helps debug JSON parsing code in Firebase.
run: cat $GITHUB_EVENT_PATH
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/deploy-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,7 @@ jobs:
ref: ${{ inputs.existing-git-tag }}

- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 11
- uses: ./.github/actions/setup-android
- name: Push to Sonatype servers
run: MODULE_VERSION=${{ needs.deploy-git-tag.outputs.new_release_version }} ./scripts/deploy-code.sh
env:
Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ jobs:
name: Android Lint (${{ matrix.module }})
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11' # Robolectric requires v9, but we choose LTS: https://adoptopenjdk.net/
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- uses: ./.github/actions/setup-android

- name: Run lint (${{ matrix.module }})
run: ./gradlew :${{ matrix.module }}:lintDebug
Expand All @@ -34,11 +28,7 @@ jobs:
name: Kotlin Lint
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11' # Robolectric requires v9, but we choose LTS: https://adoptopenjdk.net/
- uses: ./.github/actions/setup-android

- name: Install and run ktlint
run: make lint-install && make lint-no-format
6 changes: 1 addition & 5 deletions .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 11
- uses: ./.github/actions/setup-android

# Using branch name for name of snapshot. Makes it easy to remember and can easily trigger new builds of Remote Habits.
- name: Set snapshot version
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ jobs:
name: Unit tests (${{ matrix.module }})
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11' # Robolectric requires v9, but we choose LTS: https://adoptopenjdk.net/
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- uses: ./.github/actions/setup-android
- name: Run unit tests (${{ matrix.module }})
run: ./gradlew :${{ matrix.module }}:runJacocoTestReport
- name: Upload code coverage report
Expand All @@ -44,15 +38,7 @@ jobs:
sample: [kotlin_compose, java_layout]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- uses: ./.github/actions/setup-android
- name: Start emulator
uses: reactivecircus/android-emulator-runner@v2
with:
Expand Down

0 comments on commit cc48b58

Please sign in to comment.