Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caching + fix buildCode #189

Merged
merged 6 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/apk_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/checkout_submodules

- name: Setup Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'

- name: Build debug APK
run: ./gradlew assembleDebug
run: ./gradlew assembleDebug --no-daemon

- name: Upload APK
uses: actions/upload-artifact@v1
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/apk_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/checkout_submodules

- name: Setup Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'

- name: Build release APK
run: |
echo $KEYSTORE_FILE | base64 -d > app/build.keystore
./gradlew assembleRelease \
--no-daemon \
-Pandroid.injected.signing.store.file=$(pwd)/app/build.keystore \
-Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD \
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/apk_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,25 @@ jobs:
name: apk_build
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{github.event.pull_request.number}}/merge

- uses: ./.github/actions/checkout_submodules

- name: Setup Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'

- name: Build release APK
run: |
echo $KEYSTORE_FILE | base64 -d > app/build.keystore
./gradlew assembleRelease \
--no-daemon \
-Pandroid.injected.signing.store.file=$(pwd)/app/build.keystore \
-Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD \
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ jobs:
- uses: ./.github/actions/checkout_submodules

- name: Setup Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

# TODO: Without this step, the Gradle check task fails with the following error:
# Execution failed for task ':common:verifyDebugDatabaseMigration'.
# > A failure occurred while executing app.cash.sqldelight.gradle.VerifyMigrationTask$VerifyMigrationAction
# > No suitable driver found for jdbc:sqlite:
- name: Run verifyDebugDatabase
run: bash ./gradlew verifyDebugDatabaseMigration
cache: 'gradle'

- name: Run check
run: bash ./gradlew check
run: ./gradlew check --no-daemon

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
9 changes: 7 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ ktlint {

// Generate a version code from git commit count
static def generateVersionCode() {
return "git rev-list HEAD --count".execute().text.trim().toInteger()
// Unix
def result = "git rev-list HEAD --count".execute().text.trim()
// Windows
if (result.empty) result = "PowerShell -Command git rev-list HEAD --count".execute().text.trim()
if (result.empty) throw new RuntimeException("Could not generate versioncode: ${result.text}")
println("Generated the following version code: " + result.toInteger())
return result.toInteger()
}


Expand All @@ -46,7 +52,6 @@ android {

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
release {
keyAlias "trustchain"
Expand Down
Loading