|
| 1 | +name: Amplify Integration Tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main, next, stable, feat/*] |
| 5 | + schedule: |
| 6 | + # 6am pacific time daily, only runs on default branch |
| 7 | + - cron: '0 13 * * *' |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + android: |
| 15 | + runs-on: macos-latest |
| 16 | + # These permissions are needed to interact with GitHub's OIDC Token endpoint. |
| 17 | + permissions: |
| 18 | + id-token: write |
| 19 | + contents: read |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + scope: ["amplify_api_example"] #, "amplify_storage_s3_example", "amplify_auth_cognito_example"] |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 |
| 26 | + with: |
| 27 | + persist-credentials: false |
| 28 | + |
| 29 | + # Flutter requires Java 11 to build android apps with Gradle. |
| 30 | + - uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142 # 3.3.0 |
| 31 | + with: |
| 32 | + distribution: 'corretto' # Amazon Corretto Build of OpenJDK |
| 33 | + java-version: '11' |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + uses: ./.github/composite_actions/install_dependencies |
| 37 | + |
| 38 | + - name: Fetch Amplify backend configurations |
| 39 | + uses: ./.github/composite_actions/fetch_backends |
| 40 | + with: |
| 41 | + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} |
| 42 | + aws-region: ${{ secrets.AWS_REGION }} |
| 43 | + scope: ${{ matrix.scope }} |
| 44 | + api-app-id: ${{ secrets.API_APP_ID }} |
| 45 | + auth-app-id: ${{ secrets.AUTH_APP_ID }} |
| 46 | + datastore-app-id: ${{ secrets.DATASTORE_APP_ID }} |
| 47 | + storage-app-id: ${{ secrets.STORAGE_APP_ID }} |
| 48 | + |
| 49 | + - name: Build example app with integration tests |
| 50 | + run: | |
| 51 | + melos exec --scope=${{ matrix.scope }} --file-exists="integration_test/main_test.dart" --fail-fast flutter build apk --verbose |
| 52 | +
|
| 53 | + - name: Run Android integration tests |
| 54 | + uses: reactivecircus/android-emulator-runner@e790971012b979513b4e2fe70d4079bc0ca8a1ae # 2.24.0 |
| 55 | + timeout-minutes: 25 |
| 56 | + with: |
| 57 | + # API levels 30+ too slow https://github.com/ReactiveCircus/android-emulator-runner/issues/222 |
| 58 | + api-level: 29 |
| 59 | + script: melos exec -c 1 --scope ${{ matrix.scope }} -- "deviceId=emulator-5554 retries=1 \$MELOS_ROOT_PATH/build-support/integ_test_android.sh" |
| 60 | + |
| 61 | + ios: |
| 62 | + runs-on: macos-latest |
| 63 | + # These permissions are needed to interact with GitHub's OIDC Token endpoint. |
| 64 | + permissions: |
| 65 | + id-token: write |
| 66 | + contents: read |
| 67 | + strategy: |
| 68 | + fail-fast: false |
| 69 | + matrix: |
| 70 | + scope: ["amplify_api_example"] #, "amplify_storage_s3_example", "amplify_auth_cognito_example"] |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # 2.4.0 |
| 73 | + with: |
| 74 | + persist-credentials: false |
| 75 | + |
| 76 | + - name: Install dependencies |
| 77 | + uses: ./.github/composite_actions/install_dependencies |
| 78 | + |
| 79 | + - name: Boot iOS Simulator |
| 80 | + run: | |
| 81 | + xcrun simctl boot "iPhone 13" |
| 82 | +
|
| 83 | + - name: Fetch Amplify backend configurations |
| 84 | + uses: ./.github/composite_actions/fetch_backends |
| 85 | + with: |
| 86 | + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} |
| 87 | + aws-region: ${{ secrets.AWS_REGION }} |
| 88 | + scope: ${{ matrix.scope }} |
| 89 | + api-app-id: ${{ secrets.API_APP_ID }} |
| 90 | + auth-app-id: ${{ secrets.AUTH_APP_ID }} |
| 91 | + datastore-app-id: ${{ secrets.DATASTORE_APP_ID }} |
| 92 | + storage-app-id: ${{ secrets.STORAGE_APP_ID }} |
| 93 | + |
| 94 | + - name: Build example app with integration tests |
| 95 | + run: | |
| 96 | + melos exec --scope=${{ matrix.scope }} flutter build ios --simulator |
| 97 | +
|
| 98 | + - name: Run integration tests |
| 99 | + run: | |
| 100 | + melos exec -c 1 --scope ${{ matrix.scope }} -- "retries=1 \$MELOS_ROOT_PATH/build-support/integ_test_ios.sh" |
0 commit comments