Skip to content

Test Android SDK

Test Android SDK #125

name: Test Android SDK
on:
workflow_dispatch:
inputs:
caller_run_id:
type: string
required: true
permissions:
contents: write
id-token: write
jobs:
test:
name: Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install Flipt
uses: flipt-io/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.FLIPT_RELEASE_BOT_APP_ID }}
private_key: ${{ secrets.FLIPT_RELEASE_BOT_APP_PEM }}
installation_id: ${{ secrets.FLIPT_RELEASE_BOT_INSTALLATION_ID }}
- name: Download Artifact (x86_64)
uses: actions/download-artifact@v4
with:
github-token: ${{ steps.generate_token.outputs.token }}
name: flipt-engine-ffi-Android-x86_64.tar.gz
path: /tmp
run-id: ${{ inputs.caller_run_id }}
- name: Download Artifact (arm64)
uses: actions/download-artifact@v4
with:
github-token: ${{ steps.generate_token.outputs.token }}
name: flipt-engine-ffi-Android-arm64.tar.gz
path: /tmp
run-id: ${{ inputs.caller_run_id }}
- name: Extract Artifacts
run: |
mkdir -p /tmp/flipt-engine-ffi-Android-x86_64
mkdir -p /tmp/flipt-engine-ffi-Android-arm64
tar -xzvf /tmp/flipt-engine-ffi-Android-x86_64.tar.gz -C /tmp/flipt-engine-ffi-Android-x86_64
tar -xzvf /tmp/flipt-engine-ffi-Android-arm64.tar.gz -C /tmp/flipt-engine-ffi-Android-arm64
- name: Move Artifacts
run: |
mkdir -p flipt-client-kotlin-android/src/main/cpp/libs/x86_64
mkdir -p flipt-client-kotlin-android/src/main/cpp/libs/arm64-v8a
mkdir -p flipt-client-kotlin-android/src/main/cpp/include
mv /tmp/flipt-engine-ffi-Android-x86_64/target/x86_64-linux-android/release/libfliptengine.a flipt-client-kotlin-android/src/main/cpp/libs/x86_64/
mv /tmp/flipt-engine-ffi-Android-arm64/target/aarch64-linux-android/release/libfliptengine.a flipt-client-kotlin-android/src/main/cpp/libs/arm64-v8a/
cp -r flipt-engine-ffi/include/* flipt-client-kotlin-android/src/main/cpp/include
- name: Run Flipt
env:
FLIPT_STORAGE_TYPE: "local"
FLIPT_STORAGE_LOCAL_PATH: "./test/fixtures/testdata"
FLIPT_AUTHENTICATION_REQUIRED: true
FLIPT_AUTHENTICATION_METHODS_TOKEN_ENABLED: true
FLIPT_AUTHENTICATION_METHODS_TOKEN_BOOTSTRAP_TOKEN: "secret"
run: flipt&
- name: Wait for Flipt to be ready
run: |
while ! curl -s http://0.0.0.0:8080/health | grep -q "SERVING"; do
echo "Waiting for Flipt to be ready..."
sleep 1
done
- name: Run Integration Tests
uses: reactivecircus/android-emulator-runner@v2
env:
FLIPT_URL: "http://10.0.2.2:8080"
FLIPT_AUTH_TOKEN: "secret"
with:
api-level: 33
target: default
arch: x86_64
script: ./gradlew connectedAndroidTest
working-directory: ./flipt-client-kotlin-android
emulator-options: -no-window -no-snapshot -screen no-touch -noaudio -no-boot-anim -camera-back none
- name: (Fail-only) Upload the build reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-reports
path: ./flipt-client-kotlin-android/build/reports