Skip to content

Move smithy-rs outside aws-sdk-rust #1025

Move smithy-rs outside aws-sdk-rust

Move smithy-rs outside aws-sdk-rust #1025

Workflow file for this run

name: Canary
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
push:
branches:
- 'canary*'
env:
tool_rust_version: 1.74.1
rust_nightly_version: nightly-2024-02-07
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 }}
LAMBDA_TEST_S3_EXPRESS_BUCKET_NAME: ${{ secrets.CANARY_LAMBDA_TEST_S3_EXPRESS_BUCKET_NAME }}
ENABLE_S3_EXPRESS_CANARY: true
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: Install nightly
run: rustup toolchain install ${{ env.rust_nightly_version }}
- name: Install cargo component for wasm canary
env:
# Must be in sync with that specified in `smithy-rs`
CARGO_COMPONENT_VERSION: 0.7.1
run: cargo +${{ env.rust_nightly_version }} install cargo-component --locked --version ${CARGO_COMPONENT_VERSION}
- 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
run: |
mv smithy-rs ../
cd ../smithy-rs/tools/ci-cdk/canary-runner
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} \
--lambda-test-s3-express-bucket-name ${LAMBDA_TEST_S3_EXPRESS_BUCKET_NAME} \
--musl