Skip to content

Integration Tests | Push Notifications #26

Integration Tests | Push Notifications

Integration Tests | Push Notifications #26

name: Integration Tests | Push Notifications
on:
workflow_dispatch:
inputs:
ios:
description: '📱 iOS'
required: true
default: true
type: boolean
tvos:
description: '📺 tvOS'
required: true
default: true
type: boolean
watchos:
description: '⌚️ watchOS'
required: true
default: true
type: boolean
workflow_call:
permissions:
id-token: write
contents: read
jobs:
push-notification-integration-tests:
name: ${{ matrix.platform }} Tests | PushNotificationHostApp
runs-on: macos-13
timeout-minutes: 30
environment: IntegrationTest
strategy:
fail-fast: false
matrix:
platform: [iOS, tvOS, watchOS]
exclude:
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'None' }}
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'None' }}
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'None' }}
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
- name: Get build parameters for ${{ matrix.platform}}
id: platform
uses: ./.github/composite_actions/get_platform_parameters
with:
platform: ${{ matrix.platform }}
xcode_version: '14.3'
- name: Create the test configuration directory
run: mkdir -p ~/.aws-amplify/amplify-ios/testconfiguration/
- name: Download the Integration Test configurations
uses: ./.github/composite_actions/download_test_configuration
with:
resource_subfolder: push-notification
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws_region: ${{ secrets.AWS_REGION }}
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}
destination: ~/.aws-amplify/amplify-ios/testconfiguration/
- name: Set up node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 16.x
- name: Attempt to use the dependencies cache
id: dependencies-cache
timeout-minutes: 4
continue-on-error: true
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/Library/Developer/Xcode/DerivedData/Amplify
key: amplify-packages-${{ hashFiles('Package.resolved') }}
restore-keys: |
amplify-packages-
- name: Attempt to restore the build cache
id: build-cache
timeout-minutes: 4
continue-on-error: true
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ${{ github.workspace }}/Build
key: Amplify-${{ matrix.platform }}-build-cache
- name: Run Local Server
run: |
cd ./AmplifyPlugins/Notifications/Push/Tests/PushNotificationHostApp/LocalServer
npm install
npm start &
shell: bash
- name: Run ${{ matrix.platform }} Integration Tests
id: run-tests
continue-on-error: true
uses: ./.github/composite_actions/run_xcodebuild_test
with:
scheme: ${{ matrix.platform == 'watchOS' && 'PushNotificationWatchTests' || 'PushNotificationHostApp' }}
destination: ${{ steps.platform.outputs.destination }}
sdk: ${{ steps.platform.outputs.sdk }}
xcode_path: /Applications/Xcode_14.3.app
project_path: ./AmplifyPlugins/Notifications/Push/Tests/PushNotificationHostApp
generate_coverage: false
cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify
derived_data_path: ${{ github.workspace }}/Build
disable_package_resolution: ${{ steps.dependencies-cache.outputs.cache-hit }}
- name: Retry ${{ matrix.platform }} Integration Tests
if: steps.run-tests.outcome=='failure'
id: retry-tests
uses: ./.github/composite_actions/run_xcodebuild_test
with:
scheme: ${{ matrix.platform == 'watchOS' && 'PushNotificationWatchTests' || 'PushNotificationHostApp' }}
destination: ${{ steps.platform.outputs.destination }}
sdk: ${{ steps.platform.outputs.sdk }}
xcode_path: /Applications/Xcode_14.3.app
project_path: ./AmplifyPlugins/Notifications/Push/Tests/PushNotificationHostApp
generate_coverage: false
cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify
derived_data_path: ${{ github.workspace }}/Build
disable_package_resolution: true