Skip to content

Workflow file for this run

name: CloudflareWarpSpeedTest Android CI/CD
on:
push:
branches: [ "*", "*/*" ]
tags:
- 'v*'
pull_request:
branches: [ "*", "*/*" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x android/gradlew
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
sdk-platform: '34'
build-tools: '34.0.0'
- name: Build with Gradle
working-directory: ./android
run: ./gradlew build
- name: Run Tests
working-directory: ./android
run: ./gradlew test
- name: Run Lint
working-directory: ./android
run: ./gradlew lint
- name: Upload Build Reports
if: always()
uses: actions/upload-artifact@v3
with:
name: build-reports
path: android/app/build/reports
- name: Build Release APK
if: startsWith(github.ref, 'refs/tags/v')
working-directory: ./android
run: ./gradlew assembleRelease
- name: Sign Release APK
if: startsWith(github.ref, 'refs/tags/v')
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
- name: Rename APK with Version
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${GITHUB_REF#refs/tags/}
mv ${{ env.SIGNED_RELEASE_FILE }} android/app/build/outputs/apk/release/CloudflareWarpSpeedTest-${VERSION}.apk
echo "RELEASE_APK=android/app/build/outputs/apk/release/CloudflareWarpSpeedTest-${VERSION}.apk" >> $GITHUB_ENV
- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.RELEASE_APK }}
draft: true
prerelease: true