Skip to content

feat(actions): Launch Android emulator #2410

feat(actions): Launch Android emulator

feat(actions): Launch Android emulator #2410

name: Amplify Integration Tests
on:
push:
branches:
- main
- stable
- feat/**
- fix/**
- test/**
pull_request:
paths:
- ".github/workflows/amplify_integration_tests.yaml"
schedule:
# 6am pacific time daily, only runs on default branch
- cron: "0 13 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
android:
runs-on:
labels: amplify-flutter_ubuntu-latest_4-core
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
scope:
- "amplify_analytics_pinpoint_example"
- "amplify_api_example"
- "amplify_authenticator_example"
- "amplify_auth_cognito_example"
- "amplify_datastore_example"
- "amplify_storage_s3_example"
- "amplify_db_common_example"
api-level:
- 24
- 33
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
with:
persist-credentials: false
submodules: true
# Flutter requires Java 11 to build android apps with Gradle.
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # 3.12.0
with:
distribution: "corretto" # Amazon Corretto Build of OpenJDK
java-version: "11"
- name: Install dependencies
uses: ./.github/composite_actions/install_dependencies
- name: Pub Upgrade
run: aft exec --include=${{ matrix.scope }} -- flutter pub upgrade
- name: Fetch Amplify backend configurations
uses: ./.github/composite_actions/fetch_backends
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
scope: ${{ matrix.scope }}
secret-identifier: ${{ secrets.AWS_SECRET_IDENTIFIER }}
- name: Launch Android emulator
uses: ./.github/composite_actions/launch_android_emulator
# Make the timeout a little longer and add retry due to delay from starting emulator.
timeout-minutes: 90
with:
api-level: ${{ matrix.api-level }}
script: aft exec --include=${{ matrix.scope }} -- small=true "<AFT_ROOT>/build-support/integ_test.sh" -d emulator-5554 --retries 1
ios:
runs-on: macos-latest-xl
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
scope:
- "amplify_analytics_pinpoint_example"
- "amplify_api_example"
- "amplify_authenticator_example"
- "amplify_auth_cognito_example"
- "amplify_datastore_example"
- "amplify_storage_s3_example"
- "amplify_db_common_example"
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
with:
persist-credentials: false
submodules: true
- name: Install dependencies
uses: ./.github/composite_actions/install_dependencies
- name: Launch iOS simulator
uses: ./.github/composite_actions/launch_ios_simulator
timeout-minutes: 20
- name: Pub Upgrade
run: aft exec --include=${{ matrix.scope }} -- flutter pub upgrade
- name: Fetch Amplify backend configurations
uses: ./.github/composite_actions/fetch_backends
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
scope: ${{ matrix.scope }}
secret-identifier: ${{ secrets.AWS_SECRET_IDENTIFIER }}
- name: Run integration tests
timeout-minutes: 60
run: aft exec --include=${{ matrix.scope }} -- small=true "<AFT_ROOT>/build-support/integ_test_ios.sh" -d test
web:
runs-on:
labels: amplify-flutter_ubuntu-latest_4-core
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
scope:
- "amplify_analytics_pinpoint_example"
- "amplify_api_example"
# TODO(dnys1): Web UI tests are not currently able to be run in CI
# - "amplify_authenticator_example"
- "amplify_auth_cognito_example"
- "amplify_storage_s3_example"
- "amplify_db_common_example"
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
with:
persist-credentials: false
submodules: true
- name: Install dependencies
uses: ./.github/composite_actions/install_dependencies
- name: Pub Upgrade
run: aft exec --include=${{ matrix.scope }} -- flutter pub upgrade
- name: Fetch Amplify backend configurations
uses: ./.github/composite_actions/fetch_backends
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
scope: ${{ matrix.scope }}
secret-identifier: ${{ secrets.AWS_SECRET_IDENTIFIER }}
- uses: ./.github/composite_actions/setup_chromedriver
- name: Run integration tests
timeout-minutes: 60
run: |
chromedriver --port=4444 &
aft exec --include=${{ matrix.scope }} -- "<AFT_ROOT>/build-support/integ_test.sh" -d web-server
# TODO(dnys1): Re-enable with self-hosted runners
# macos:
# runs-on: macos-latest
# # These permissions are needed to interact with GitHub's OIDC Token endpoint.
# permissions:
# id-token: write
# contents: read
# strategy:
# fail-fast: false
# matrix:
# scope:
# - "amplify_analytics_pinpoint_example"
# - "amplify_api_example"
# # TODO(dnys1): macOS tests are failing for some reason
# # - "amplify_authenticator_example"
# - "amplify_auth_cognito_example"
# - "amplify_storage_s3_example"
# - "amplify_db_common_example"
# steps:
# - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
# with:
# persist-credentials: false
# submodules: true
# - name: Install dependencies
# uses: ./.github/composite_actions/install_dependencies
# with:
# channel: stable
# flutter-version: "3.3.10"
# - name: Fetch Amplify backend configurations
# uses: ./.github/composite_actions/fetch_backends
# with:
# role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
# aws-region: ${{ secrets.AWS_REGION }}
# scope: ${{ matrix.scope }}
# secret-identifier: ${{ secrets.AWS_SECRET_IDENTIFIER }}
# - name: Run integration tests
# timeout-minutes: 30
# run: |
# flutter config --enable-macos-desktop
# aft exec --include=${{ matrix.scope }} -- "<AFT_ROOT>/build-support/integ_test.sh" -d macos
linux:
runs-on:
labels: amplify-flutter_ubuntu-latest_4-core
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
scope:
- "amplify_analytics_pinpoint_example"
- "amplify_api_example"
- "amplify_authenticator_example"
- "amplify_auth_cognito_example"
- "amplify_storage_s3_example"
- "amplify_db_common_example"
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
with:
persist-credentials: false
submodules: true
- name: Install dependencies
uses: ./.github/composite_actions/install_dependencies
- name: Pub Upgrade
run: aft exec --include=${{ matrix.scope }} -- flutter pub upgrade
- name: Fetch Amplify backend configurations
uses: ./.github/composite_actions/fetch_backends
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
scope: ${{ matrix.scope }}
secret-identifier: ${{ secrets.AWS_SECRET_IDENTIFIER }}
- name: Run integration tests
timeout-minutes: 60
run: |
flutter config --enable-linux-desktop
aft exec --include=${{ matrix.scope }} -- "<AFT_ROOT>/build-support/integ_test.sh" -d linux
windows:
runs-on: windows-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
scope:
- "amplify_analytics_pinpoint_example"
- "amplify_api_example"
- "amplify_authenticator_example"
- "amplify_auth_cognito_example"
- "amplify_storage_s3_example"
- "amplify_db_common_example"
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
with:
persist-credentials: false
submodules: true
- name: Change path restrictions
run: git config --global core.longpaths true
- name: Install dependencies
uses: ./.github/composite_actions/install_dependencies
- name: Pub Upgrade
run: dart pub global run aft exec --include=${{ matrix.scope }} -- flutter pub upgrade
- name: Fetch Amplify backend configurations
uses: ./.github/composite_actions/fetch_backends
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
scope: ${{ matrix.scope }}
secret-identifier: ${{ secrets.AWS_SECRET_IDENTIFIER }}
- name: Run integration tests
timeout-minutes: 60
run: |
flutter config --enable-windows-desktop
dart pub global run aft exec --include=${{ matrix.scope }} -- flutter test integration_test/main_test.dart -d windows