Skip to content

Support hand written integration tests #338

Support hand written integration tests

Support hand written integration tests #338

# This script is for building the full SDK
# It will regenerate all models, build the full SDK with the new models, and run tests.
name: Codegen, Build, and Test triggered via comment
on:
issue_comment:
types: [created]
env:
BUILDER_VERSION: v0.8.19
BUILDER_SOURCE: releases
# host owned by CRT team to host aws-crt-builder releases. Contact their on-call with any issues
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-sdk-swift
LINUX_BASE_IMAGE: ubuntu-16-x64
RUN: ${{ github.run_id }}-${{ github.run_number }}
AWS_SDK_SWIFT_CI_DIR: /Users/runner/work/aws-sdk-swift/aws-sdk-swift
AWS_CRT_SWIFT_CI_DIR: /Users/runner/work/aws-sdk-swift/aws-sdk-swift/target/build/deps/aws-crt-swift
SMITHY_SWIFT_CI_DIR: /Users/runner/work/aws-sdk-swift/aws-sdk-swift/target/build/deps/smithy-swift
AWS_SWIFT_SDK_USE_LOCAL_DEPS: 1
jobs:
codegen-build-test:
runs-on: macos-13-xl
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test')
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- name: Set initial commit status as pending
uses: myrotvorets/set-commit-status-action@master
if: always()
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout PR branch
uses: actions/checkout@v3
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Print Tools Versions
run: |
which swiftc
swiftc --version
echo
which xcodebuild
xcodebuild -version
echo
which java
java --version
echo
echo "Head ref for comment PR: ${{ steps.comment-branch.outputs.head_ref }}"
echo "SHA for comment PR: ${{ steps.comment-branch.outputs.head_sha }}"
- name: Build and Test ${{ env.PACKAGE_NAME }}
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
chmod a+x builder.pyz
GITHUB_HEAD_REF="${{ steps.comment-branch.outputs.head_ref }}" ./builder.pyz build -p ${{ env.PACKAGE_NAME }}
./gradlew -p codegen/sdk-codegen build
./gradlew -p codegen/sdk-codegen stageSdks
./gradlew --stop
./scripts/mergeModels.sh Sources/Services
cd AWSSDKSwiftCLI
swift run AWSSDKSwiftCLI generate-package-manifest ../
cd ..
cat Package.swift
swift build --build-tests
swift test --skip-build
- name: Set final commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@master
if: always()
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}