Canary #1015
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: Canary | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
env: | |
tool_rust_version: 1.70.0 | |
jobs: | |
generate-canary-matrix: | |
runs-on: ubuntu-latest | |
name: Generate Canary Matrix | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: awslabs/smithy-rs | |
path: smithy-rs | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.tool_rust_version }} | |
- name: Generate the matrix | |
id: generate-matrix | |
working-directory: smithy-rs/tools/ci-cdk/canary-runner | |
# Run the `canary-runner generate-matrix` subcommand to calculate a test matrix | |
# for the `canary` job. This script outputs JSON that GitHub Actions can consume | |
# as a matrix definition. Rust versions to test against are arguments to this script. | |
run: | | |
cargo build | |
# Rust versions should just be the MSRV and the latest stable compiler | |
echo "matrix=$(cargo run -- generate-matrix --sdk-versions 3 --rust-versions ${{ env.tool_rust_version }} stable)" >> "${GITHUB_OUTPUT}" | |
outputs: | |
matrix: ${{ steps.generate-matrix.outputs.matrix }} | |
canary: | |
needs: generate-canary-matrix | |
name: Canary | |
runs-on: ubuntu-latest | |
env: | |
AWS_DEFAULT_REGION: us-west-2 | |
CARGO_INCREMENTAL: "0" | |
RUST_VERSION: ${{ matrix.rust_version }} | |
SDK_RELEASE_TAG: ${{ matrix.sdk_release_tag }} | |
LAMBDA_CODE_S3_BUCKET_NAME: ${{ secrets.CANARY_LAMBDA_CODE_S3_BUCKET }} | |
LAMBDA_TEST_S3_BUCKET_NAME: ${{ secrets.CANARY_LAMBDA_TEST_S3_BUCKET }} | |
LAMBDA_EXECUTION_ROLE_ARN: ${{ secrets.CANARY_LAMBDA_EXECUTION_ROLE_ARN }} | |
LAMBDA_TEST_S3_MRAP_BUCKET_ARN: ${{ secrets.CANARY_LAMBDA_TEST_S3_MRAP_BUCKET_ARN }} | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
strategy: | |
fail-fast: false | |
# Use the matrix generated by the previous job | |
matrix: ${{ fromJson(needs.generate-canary-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: awslabs/smithy-rs | |
path: smithy-rs | |
# Fetch all history so that the runner can change to different commits | |
fetch-depth: 0 | |
# Each canary run uses a different Rust version, and the `rust-toolchain.toml` | |
# file interferes with that version selection. | |
- name: Delete `rust-toolchain.toml` | |
working-directory: smithy-rs | |
run: rm rust-toolchain.toml | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust_version }} | |
targets: x86_64-unknown-linux-musl | |
- name: Install musl-gcc | |
run: sudo apt-get install -y musl-dev musl-tools | |
- name: Compile the canary runner | |
working-directory: smithy-rs/tools/ci-cdk/canary-runner | |
run: cargo build | |
- uses: aws-actions/configure-aws-credentials@v4 | |
name: Acquire credentials for running the canary | |
with: | |
role-to-assume: ${{ secrets.CANARY_GITHUB_ACTIONS_ROLE_ARN }} | |
aws-region: us-west-2 | |
- name: Run the canary | |
working-directory: smithy-rs/tools/ci-cdk/canary-runner | |
run: | | |
cargo run -- \ | |
run --rust-version ${RUST_VERSION} \ | |
--sdk-release-tag ${SDK_RELEASE_TAG} \ | |
--lambda-code-s3-bucket-name ${LAMBDA_CODE_S3_BUCKET_NAME} \ | |
--lambda-test-s3-bucket-name ${LAMBDA_TEST_S3_BUCKET_NAME} \ | |
--lambda-execution-role-arn ${LAMBDA_EXECUTION_ROLE_ARN} \ | |
--lambda-test-s3-mrap-bucket-arn ${LAMBDA_TEST_S3_MRAP_BUCKET_ARN} \ | |
--musl |