feat: Run integration tests on full Apple CI matrix #444
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration Tests | |
on: | |
pull_request: | |
workflow_dispatch: | |
env: | |
AWS_SWIFT_SDK_USE_LOCAL_DEPS: 1 | |
permissions: | |
id-token: write | |
jobs: | |
apple: | |
runs-on: ${{ matrix.runner }} | |
env: | |
DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer | |
strategy: | |
fail-fast: false | |
matrix: | |
# This matrix runs tests on iOS sim & Mac, on oldest & newest supported Xcodes | |
runner: | |
- macos-13-xlarge | |
- macos-14-xlarge | |
xcode: | |
- Xcode_14.1 | |
- Xcode_15.3 | |
destination: | |
- 'platform=iOS Simulator,OS=16.1,name=iPhone 14' | |
- 'platform=iOS Simulator,OS=17.4,name=iPhone 15' | |
- 'platform=tvOS Simulator,OS=16.1,name=Apple TV 4K (3rd generation) (at 1080p)' | |
- 'platform=tvOS Simulator,OS=17.4,name=Apple TV 4K (3rd generation) (at 1080p)' | |
- 'platform=OS X' | |
exclude: | |
# Don't run old macOS with new Xcode | |
- runner: macos-13-xlarge | |
xcode: Xcode_15.3 | |
# Don't run new macOS with old Xcode | |
- runner: macos-14-xlarge | |
xcode: Xcode_14.1 | |
# Don't run old simulators with new Xcode | |
- destination: 'platform=tvOS Simulator,OS=16.1,name=Apple TV 4K (3rd generation) (at 1080p)' | |
xcode: Xcode_15.3 | |
- destination: 'platform=iOS Simulator,OS=16.1,name=iPhone 14' | |
xcode: Xcode_15.3 | |
# Don't run new simulators with old Xcode | |
- destination: 'platform=tvOS Simulator,OS=17.4,name=Apple TV 4K (3rd generation) (at 1080p)' | |
xcode: Xcode_14.1 | |
- destination: 'platform=iOS Simulator,OS=17.4,name=iPhone 15' | |
xcode: Xcode_14.1 | |
steps: | |
- name: Configure AWS Credentials for Integration Tests | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.INTEGRATION_TEST_ROLE_ARN }} | |
aws-region: us-west-2 | |
- name: Checkout aws-sdk-swift | |
uses: actions/checkout@v3 | |
- name: Select smithy-swift branch | |
run: | | |
ORIGINAL_REPO_HEAD_REF="$GITHUB_HEAD_REF" \ | |
DEPENDENCY_REPO_URL="https://github.com/smithy-lang/smithy-swift.git" \ | |
./scripts/ci_steps/select_dependency_branch.sh | |
- name: Checkout smithy-swift | |
uses: actions/checkout@v3 | |
with: | |
repository: smithy-lang/smithy-swift | |
ref: ${{ env.DEPENDENCY_REPO_SHA }} | |
path: smithy-swift | |
- name: Move smithy-swift into place | |
run: mv smithy-swift .. | |
- name: Cache Gradle | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: 1-${{ runner.os }}-gradle-${{ hashFiles('settings.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
1-${{ runner.os }}-gradle-${{ hashFiles('settings.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }} | |
1-${{ runner.os }}-gradle- | |
- name: Cache Swift | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/Library/Caches/org.swift.swiftpm | |
~/.cache/org.swift.swiftpm | |
key: 1-${{ runner.os }}-${{ matrix.xcode }}-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }} | |
restore-keys: | | |
1-${{ runner.os }}-${{ matrix.xcode }}-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }} | |
1-${{ runner.os }}-${{ matrix.xcode }}- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: 17 | |
- name: Tools Versions | |
run: ./scripts/ci_steps/log_tool_versions.sh | |
- name: Add Credentials to Test Plan | |
run: | | |
# JSON-escape the credentials. They are also surrounded with double quotes. | |
AKID_ESCAPED=`echo -n "$AWS_ACCESS_KEY_ID" | jq -Rsa .` | |
SECRET_ESCAPED=`echo -n "$AWS_SECRET_ACCESS_KEY" | jq -Rsa .` | |
REGION_ESCAPED=`echo -n "$AWS_DEFAULT_REGION" | jq -Rsa .` | |
TOKEN_ESCAPED=`echo -n "$AWS_SESSION_TOKEN" | jq -Rsa .` | |
# Insert the credentials into the .xctestplan file, write the modified JSON | |
# to a temp file, then move the temp over the original. | |
jq ".defaultOptions.environmentVariableEntries += [{\"key\": \"AWS_ACCESS_KEY_ID\", \"value\": $AKID_ESCAPED}, {\"key\": \"AWS_SECRET_ACCESS_KEY\", \"value\": $SECRET_ESCAPED}, {\"key\": \"AWS_DEFAULT_REGION\", \"value\": $REGION_ESCAPED}, {\"key\": \"AWS_SESSION_TOKEN\", \"value\": $TOKEN_ESCAPED}]" TestPlans/AWSIntegrationTestsOnCI.xctestplan > testplan.tmp | |
mv testplan.tmp TestPlans/AWSIntegrationTestsOnCI.xctestplan | |
- name: Prepare Integration Tests | |
run: ./scripts/ci_steps/prepare_integration_tests.sh | |
- name: Run Integration Tests | |
run: | | |
set -o pipefail && \ | |
NSUnbufferedIO=YES xcodebuild \ | |
-scheme AWSIntegrationTestsOnCI \ | |
-testPlan AWSIntegrationTestsOnCI \ | |
-destination '${{ matrix.destination }}' \ | |
test 2>&1 \ | |
| xcpretty | |
linux: | |
runs-on: ubuntu-latest | |
container: swift:${{ matrix.version }}-${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- jammy | |
#- amazonlinux2 | |
version: | |
- "5.7" | |
- "5.10" | |
steps: | |
- name: Configure AWS Credentials for Integration Tests | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.INTEGRATION_TEST_ROLE_ARN }} | |
aws-region: us-west-2 | |
- name: Checkout aws-sdk-swift | |
uses: actions/checkout@v3 | |
- name: Select smithy-swift branch | |
run: | | |
ORIGINAL_REPO_HEAD_REF="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME:-main}}" \ | |
DEPENDENCY_REPO_URL="https://github.com/smithy-lang/smithy-swift.git" \ | |
./scripts/ci_steps/select_dependency_branch.sh | |
- name: Checkout smithy-swift | |
uses: actions/checkout@v3 | |
with: | |
repository: smithy-lang/smithy-swift | |
ref: ${{ env.DEPENDENCY_REPO_SHA }} | |
path: smithy-swift | |
- name: Move smithy-swift into place | |
run: mv smithy-swift .. | |
- name: Cache Gradle | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: 1-${{ runner.os }}-gradle-${{ hashFiles('settings.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
1-${{ runner.os }}-gradle-${{ hashFiles('settings.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }} | |
1-${{ runner.os }}-gradle- | |
- name: Cache Swift | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/Library/Caches/org.swift.swiftpm | |
~/.cache/org.swift.swiftpm | |
key: 1-${{ runner.os }}-swift-${{ matrix.version }}-spm-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }} | |
restore-keys: | | |
1-${{ runner.os }}-swift-${{ matrix.version }}-spm-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }} | |
1-${{ runner.os }}-swift-${{ matrix.version }}-spm- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: 17 | |
- name: Install OpenSSL (all OS) and which (AL2 only) | |
run: ./scripts/ci_steps/install_native_linux_dependencies.sh | |
- name: Tools Versions | |
run: ./scripts/ci_steps/log_tool_versions.sh | |
- name: Prepare Integration Tests | |
run: ./scripts/ci_steps/prepare_integration_tests.sh | |
- name: Build Integration Tests | |
run: swift build --build-tests | |
- name: Run Integration Tests | |
run: swift test |