Skip to content

MOB-11527: Business Critical Integration Push Notifications #5

MOB-11527: Business Critical Integration Push Notifications

MOB-11527: Business Critical Integration Push Notifications #5

name: Business Critical Integration Tests
on:
pull_request:
branches: [ master ]
paths:
- 'swift-sdk/SDK/**'
- 'swift-sdk/Internal/**'
- 'tests/business-critical-integration/**'
push:
branches: [ master ]
schedule:
# Run daily at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
test_suite:
description: 'Test suite to run (all, push, inapp, embedded, deeplink)'
required: false
default: 'all'
type: choice
options:
- all
- push
- inapp
- embedded
- deeplink
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
ITERABLE_API_KEY: ${{ secrets.ITERABLE_API_KEY }}
ITERABLE_SERVER_KEY: ${{ secrets.ITERABLE_SERVER_KEY }}
TEST_PROJECT_ID: ${{ secrets.TEST_PROJECT_ID }}
TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}
APNS_CERTIFICATE: ${{ secrets.APNS_CERTIFICATE }}
jobs:
integration-tests:
name: Integration Tests
runs-on: macos-14
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
test_suite:
- push-notifications
- inapp-messages
- embedded-messages
- deep-linking
include:
- test_suite: push-notifications
workflow_file: push-notification-test.yml
test_name: "Push Notification Integration"
- test_suite: inapp-messages
workflow_file: inapp-message-test.yml
test_name: "In-App Message Integration"
- test_suite: embedded-messages
workflow_file: embedded-message-test.yml
test_name: "Embedded Message Integration"
- test_suite: deep-linking
workflow_file: deep-linking-test.yml
test_name: "Deep Linking Integration"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Cache Build Dependencies
uses: actions/cache@v4
with:
path: |
~/Library/Caches/org.swift.swiftpm
~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-xcode-${{ hashFiles('Package.swift', 'swift-sdk.xcodeproj/**') }}
restore-keys: |
${{ runner.os }}-xcode-
- name: Setup iOS Simulator
run: |
xcrun simctl list devices iPhone
# Boot latest iPhone Pro simulator
DEVICE_UUID=$(xcrun simctl list devices iPhone | grep "iPhone 16 Pro" | grep -v "Plus" | head -1 | grep -o "[A-F0-9-]\{36\}")
echo "SIMULATOR_UUID=$DEVICE_UUID" >> $GITHUB_ENV
xcrun simctl boot $DEVICE_UUID || true
xcrun simctl list devices | grep Booted
- name: Setup Test Environment
run: |
chmod +x tests/business-critical-integration/scripts/setup-test-environment.sh
./tests/business-critical-integration/scripts/setup-test-environment.sh
- name: Build Test Application
run: |
xcodebuild build-for-testing \
-project swift-sdk.xcodeproj \
-scheme swift-sdk \
-sdk iphonesimulator \
-destination "id=$SIMULATOR_UUID" \
-configuration Release \
-derivedDataPath ./DerivedData
- name: Run Integration Test Suite
run: |
chmod +x tests/business-critical-integration/scripts/integration-test-${{ matrix.test_suite }}.sh
./tests/business-critical-integration/scripts/integration-test-${{ matrix.test_suite }}.sh
timeout-minutes: 15
- name: Validate Backend State
if: always()
run: |
chmod +x tests/business-critical-integration/scripts/validate-backend-state.sh
./tests/business-critical-integration/scripts/validate-backend-state.sh ${{ matrix.test_suite }}
- name: Cleanup Test Data
if: always()
run: |
chmod +x tests/business-critical-integration/scripts/cleanup-test-data.sh
./tests/business-critical-integration/scripts/cleanup-test-data.sh ${{ matrix.test_suite }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.test_suite }}
path: |
tests/business-critical-integration/reports/
tests/business-critical-integration/screenshots/
DerivedData/Logs/Test/
retention-days: 7
- name: Upload Screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots-${{ matrix.test_suite }}
path: tests/business-critical-integration/screenshots/
retention-days: 7
aggregate-results:
name: Aggregate Test Results
runs-on: macos-14
needs: integration-tests
if: always()
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download All Test Results
uses: actions/download-artifact@v4
with:
path: test-results/
- name: Generate Summary Report
run: |
mkdir -p final-reports
echo "# Business Critical Integration Test Results" > final-reports/summary.md
echo "**Run Date:** $(date)" >> final-reports/summary.md
echo "**Commit:** ${{ github.sha }}" >> final-reports/summary.md
echo "" >> final-reports/summary.md
# Process each test suite result
for suite in push-notifications inapp-messages embedded-messages deep-linking; do
echo "## $suite Test Results" >> final-reports/summary.md
if [ -d "test-results/test-results-$suite" ]; then
if [ -f "test-results/test-results-$suite/result.json" ]; then
cat "test-results/test-results-$suite/result.json" >> final-reports/summary.md
else
echo "❌ Test suite failed or incomplete" >> final-reports/summary.md
fi
else
echo "❌ Test results not found" >> final-reports/summary.md
fi
echo "" >> final-reports/summary.md
done
- name: Upload Final Report
uses: actions/upload-artifact@v4
with:
name: final-integration-test-report
path: final-reports/
retention-days: 30
- name: Notify on Failure
if: failure()
uses: 8398a7/action-slack@v3
with:
status: failure
text: "❌ Business Critical Integration Tests Failed - Check GitHub Actions for details"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}