Files
firezone/.github/workflows/_kotlin.yml
Jamil 8eb738e66a chore(ci): downgrade runners to free tier (#10248)
To avoid burning Azure credits, we move the runners back down to the
free tier. Now that caching is properly set up, this should incur only a
minor increase in CI time.
2025-08-26 10:48:45 -07:00

140 lines
5.5 KiB
YAML

name: Kotlin
on:
workflow_call:
workflow_dispatch:
defaults:
run:
working-directory: ./kotlin/android
permissions:
contents: "read"
id-token: "write"
jobs:
static-analysis:
# Android SDK tools hardware accel is available only on Linux runners
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup-android
with:
sccache_azure_connection_string: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }}
- name: Run linter
run: ./gradlew spotlessCheck
update-release-draft:
name: update-release-draft
runs-on: ubuntu-22.04
permissions:
contents: write # for updating the release draft
env:
# mark:next-android-version
RELEASE_NAME: android-client-1.5.4
steps:
- uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
if: "${{ github.event_name == 'workflow_dispatch' && github.ref_name == 'main' }}"
id: update-release-draft
with:
config-name: release-drafter-android-client.yml
tag: ${{ env.RELEASE_NAME }}
version: ${{ env.RELEASE_NAME }}
name: ${{ env.RELEASE_NAME }}
commitish: ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_release:
permissions:
contents: write # for uploading artifacts to the release
id-token: write
name: build-release-${{ matrix.package-type }}
needs: update-release-draft
if: "${{ github.event_name == 'workflow_dispatch' }}"
# Android SDK tools hardware accel is available only on Linux runners
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- package-type: aab
build-command: "./gradlew bundleRelease"
output-path: app/build/outputs/bundle/release/app-release.aab
- package-type: apk
build-command: "./gradlew assembleRelease"
output-path: app/build/outputs/apk/release/app-release.apk
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-tags: true # Otherwise we cannot embed the correct version into the build.
- uses: ./.github/actions/setup-android
with:
sccache_azure_connection_string: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }}
- name: Build the release package
env:
KEYSTORE_BASE64: ${{ secrets.GOOGLE_UPLOAD_KEYSTORE_BASE64 }}
KEYSTORE_PASSWORD: ${{ secrets.GOOGLE_UPLOAD_KEYSTORE_PASSWORD }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.GOOGLE_UPLOAD_KEYSTORE_KEY_PASSWORD }}
run: |
KEYSTORE_PATH="$(pwd)/app/keystore.jks"
echo -n "$KEYSTORE_BASE64" | base64 --decode > "$KEYSTORE_PATH"
${{ matrix.build-command }}
rm "$KEYSTORE_PATH"
- name: Setup sentry CLI
if: "${{ github.event_name == 'workflow_dispatch' }}"
uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b #v2.0.0
with:
token: ${{ secrets.SENTRY_AUTH_TOKEN }}
organization: firezone-inc
- name: Upload debug symbols to Sentry
if: "${{ github.event_name == 'workflow_dispatch' }}"
run: |
sentry-cli debug-files upload --log-level info --project android-client --include-sources ../../rust/target
- name: Run Unit Test
run: |
./gradlew testReleaseUnitTest
- name: Upload package artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: Android ${{ matrix.package-type }}
path: |
./kotlin/android/${{ matrix.output-path }}
- name: Upload package to release
if: ${{ github.ref_name == 'main' && matrix.package-type == 'apk' && github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# mark:next-android-version
RELEASE_NAME: android-client-1.5.4
run: |
export ARTIFACT_PATH="$RUNNER_TEMP/firezone-${RELEASE_NAME}.${{ matrix.package-type }}"
cp "${{ matrix.output-path }}" "$ARTIFACT_PATH"
../../scripts/upload/github-release.sh
- name: Distribute release to Firebase App Distribution
if: ${{ matrix.package-type == 'aab' && github.event_name == 'workflow_dispatch' }}
env:
FIREBASE_APP_DISTRIBUTION_CREDENTIALS: ${{ secrets.FIREBASE_APP_DISTRIBUTION_CREDENTIALS }}
FIREBASE_CREDENTIALS_PATH: firebase-credentials.json
FIREBASE_APP_TESTERS: ${{ vars.FIREBASE_APP_TESTERS }}
run: |
echo -n "$FIREBASE_APP_DISTRIBUTION_CREDENTIALS" > "$FIREBASE_CREDENTIALS_PATH"
./gradlew appDistributionUploadRelease uploadCrashlyticsSymbolFileRelease
build_debug:
# Android SDK tools hardware accel is available only on Linux runners
runs-on: ubuntu-22.04
name: build-debug
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup-android
with:
sccache_azure_connection_string: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }}
- name: Build debug APK
run: |
./gradlew assembleDebug
- name: Upload debug APK
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: Android debug APK
path: |
./kotlin/android/app/build/outputs/apk/*