chore: track artifact sizes #983
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: AWS CodeBuild CI | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
aws-sdk-kotlin-pr: | |
description: aws-sdk-kotlin PR number (optional) | |
type: number | |
required: false | |
smithy-kotlin-pr: | |
description: smithy-kotlin PR number (optional) | |
type: number | |
required: false | |
check-pr: | |
description: I verified that the PRs are not running any malicious code (If running for an external contributor) | |
required: true | |
type: boolean | |
default: false | |
env: | |
SDK_PR: ${{ inputs.aws-sdk-kotlin-pr }} | |
SMITHY_PR: ${{ inputs.smithy-kotlin-pr }} | |
permissions: | |
id-token: write | |
contents: read | |
# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed | |
concurrency: | |
group: ci-codebuild-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
e2e-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Verify PRs are not running malicious code | |
if: ${{ (inputs.aws-sdk-kotlin-pr != '' || inputs.smithy-kotlin-pr != '') && inputs.check-pr == false }} | |
run: | | |
echo Please verify the PRs are not running any malicious code and mark the checkbox true when running the workflow | |
exit 1 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} | |
aws-region: us-west-2 | |
- name: Run E2E Tests | |
id: e2e-tests | |
uses: aws-actions/aws-codebuild-run-build@v1 | |
with: | |
project-name: gh-aws-sdk-kotlin-e2e-tests | |
env-vars-for-codebuild: SDK_PR, SMITHY_PR | |
- name: Cancel build | |
if: ${{ cancelled() }} | |
env: | |
BUILD_ID: ${{ steps.e2e-tests.outputs.aws-build-id }} | |
run: | | |
if [ ! -z "$BUILD_ID"]; then | |
echo "cancelling in-progress build: id=$BUILD_ID" | |
aws codebuild stop-build --id $BUILD_ID | |
fi | |
service-check-batch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Verify PRs are not running malicious code | |
if: ${{ (inputs.aws-sdk-kotlin-pr != '' || inputs.smithy-kotlin-pr != '') && inputs.check-pr == false }} | |
run: | | |
echo Please verify the PRs are not running any malicious code and mark the checkbox true when running the workflow | |
exit 1 | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} | |
aws-region: us-west-2 | |
- name: Run Service Check Batch | |
id: svc-check-batch | |
run: | | |
.github/scripts/run-codebuild-batch-job.sh \ | |
--project gh-aws-sdk-kotlin-svc-check-batch \ | |
--source ${{ github.event.pull_request.head.sha }} \ | |
--sdk-pr ${{ inputs.aws-sdk-kotlin-pr }} \ | |
--smithy-pr ${{ inputs.smithy-kotlin-pr }} | |
- name: Cancel build | |
if: ${{ cancelled() }} | |
env: | |
BUILD_ID: ${{ steps.svc-check-batch.outputs.aws-build-id }} | |
run: | | |
if [ ! -z "$BUILD_ID" ]; then | |
echo "cancelling in-progress batch build: id=$BUILD_ID" | |
aws codebuild stop-build --id $BUILD_ID | |
fi |