Integration Tests workflow (aws/aws-sdk-go-v2)
The Integration Tests workflow from aws/aws-sdk-go-v2, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Integration Tests workflow from the aws/aws-sdk-go-v2 repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Integration Tests
# these are expensive, limit how often they're running
#
# functionally, all we need to do is vet the code going into main
on:
pull_request:
branches:
- main
permissions:
id-token: write
# again, expensive, only one per PR can run and they self-cancel
concurrency:
group: ci-codebuild-${{ github.ref }}
cancel-in-progress: true
jobs:
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- 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 tests
id: integration-tests
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: aws-sdk-go-v2-integrationtests
- name: Cancel tests
if: ${{ cancelled() }}
env:
BUILD_ID: ${{ steps.integration-tests.outputs.aws-build-id }}
run: |
if [ ! -z "$BUILD_ID" ]; then
echo "aws codebuild stop-build --id $BUILD_ID"
aws codebuild stop-build --id $BUILD_ID
fi
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Integration Tests # these are expensive, limit how often they're running # # functionally, all we need to do is vet the code going into main on: pull_request: branches: - main permissions: id-token: write # again, expensive, only one per PR can run and they self-cancel concurrency: group: ci-codebuild-${{ github.ref }} cancel-in-progress: true jobs: integration-tests: timeout-minutes: 30 name: Integration Tests runs-on: latchkey-small steps: - 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 tests id: integration-tests uses: aws-actions/aws-codebuild-run-build@v1 with: project-name: aws-sdk-go-v2-integrationtests - name: Cancel tests if: ${{ cancelled() }} env: BUILD_ID: ${{ steps.integration-tests.outputs.aws-build-id }} run: | if [ ! -z "$BUILD_ID" ]; then echo "aws codebuild stop-build --id $BUILD_ID" aws codebuild stop-build --id $BUILD_ID fi
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.