Skip to content

CI

CI #1863

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
- cron: '0 12 * * *' # Run every day at 7/8 AM Eastern
jobs:
CI:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
# Avoid concurrency issues
BROWSERSTACK_CUSTOM_ID: ${{ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch') && format('pr-{0}', github.sha) || 'AndroidApp' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Run unit tests for the debug build
run: ./gradlew testDebugUnitTest --stacktrace
- name: Build release and debug variants
run: ./gradlew assemble --stacktrace
- name: Upload App to BrowserStack
run: |
curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" -X POST \
https://api-cloud.browserstack.com/app-automate/upload \
-F "file=@${{ github.workspace }}/sample-app/build/outputs/apk/debug/sample-app-debug.apk" \
-F "custom_id=${{ env.BROWSERSTACK_CUSTOM_ID }}"
- name: Checkout Integration Test Repo
uses: actions/checkout@v3
with:
repository: teamforage/mobile-qa-tests
ref: main
ssh-key: ${{ secrets.MOBILE_QA_DEPLOY_KEY }}
path: 'mobile-qa-tests/'
- name: Run Integration Tests
run: |
cd mobile-qa-tests
pip install -r requirements.txt
export BROWSERSTACK_CUSTOM_ID=${{ env.BROWSERSTACK_CUSTOM_ID }}
pytest android/tests/test_basic_flow.py || true
pytest --lf --last-failed-no-failures none --suppress-no-test-exit-code android/tests/test_basic_flow.py
- name: Upload build outputs (APKs and SDK AARs)
uses: actions/upload-artifact@v3
with:
name: build-outputs
path: |
sample-app/build/outputs/
forage-android/build/outputs/