chore(deps): update github artifact actions to v4 (major) #2019
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: Test | |
concurrency: | |
group: pr-test | |
cancel-in-progress: false | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
src: ${{ steps.changes.outputs.src }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
src: | |
- src/** | |
- test/** | |
- Cargo.toml | |
- Cargo.lock | |
test: | |
needs: changes | |
if: needs.changes.outputs.src == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust-toolchain: | |
- stable | |
- nightly | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Update local toolchain | |
run: | | |
rustup update | |
- name: Install nightly | |
if: matrix.rust-toolchain == 'nightly' | |
run: | | |
rustup install nightly | |
rustup default ${{ matrix.rust-toolchain }} | |
- name: Install clippy | |
if: matrix.rust-toolchain == 'stable' | |
run: | | |
rustup component add clippy | |
- name: Toolchain info | |
run: | | |
cargo --version --verbose | |
rustc --version | |
[ "${{ matrix.rust-toolchain }}" == 'stable' ] && cargo clippy --version || : | |
- name: Dependency cache | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-${{ matrix.rust-toolchain }}-target-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.rust-toolchain }}-target- | |
- name: Lint | |
if: matrix.rust-toolchain == 'stable' | |
run: | | |
cargo fmt -- --check | |
cargo clippy -- -D warnings | |
- name: Test | |
run: | | |
cargo check | |
cargo test --all | |
- name: Build | |
run: | | |
cargo install --path . | |
- uses: actions/setup-node@v4 | |
if: matrix.rust-toolchain == 'stable' | |
with: | |
node-version: 20 | |
- name: npm dependency cache | |
if: matrix.rust-toolchain == 'stable' | |
uses: actions/cache@v4 | |
with: | |
path: test/cdk/.npm | |
key: ${{ runner.os }}-${{ matrix.rust-toolchain }}-node-${{ hashFiles('test/cdk/node_modules/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.rust-toolchain }}-node- | |
- name: Prepare test stacks | |
if: matrix.rust-toolchain == 'stable' | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
make test | |
- name: Run test migrations | |
if: matrix.rust-toolchain == 'stable' | |
working-directory: test/cdk | |
run: | | |
echo "######### Testing migration from ${STACK1} to ${STACK2} #########" | |
cfn-teleport --source "${STACK1}" --target "${STACK2}" --yes \ | |
--resource "${BUCKET1}" \ | |
--resource "${BUCKET2}" \ | |
--resource "${INSTANCE}" \ | |
--resource "${SECURITY_GROUP}" \ | |
--resource "${KEY_PAIR}" \ | |
--resource "${INSTANCE_PROFILE}" \ | |
--resource "${ROLE}" \ | |
--resource "${DYNAMO_TABLE}" | |
if npx cdk diff --fail; then | |
echo "Migration failed, cdk diff did not show changes" | |
exit 1 | |
fi | |
echo "######### Testing migration from ${STACK2} to ${STACK1} #########" | |
cfn-teleport --source "${STACK2}" --target "${STACK1}" --yes \ | |
--resource "${BUCKET1}" \ | |
--resource "${BUCKET2}" \ | |
--resource "${INSTANCE}" \ | |
--resource "${SECURITY_GROUP}" \ | |
--resource "${KEY_PAIR}" \ | |
--resource "${INSTANCE_PROFILE}" \ | |
--resource "${ROLE}" \ | |
--resource "${DYNAMO_TABLE}" | |
if ! npx cdk diff --fail; then | |
echo "Migration failed, cdk diff did show changes" | |
exit 1 | |
fi | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
STACK1: CfnTeleportTest1 | |
STACK2: CfnTeleportTest2 | |
BUCKET1: Bucket182C536A1 | |
BUCKET2: Bucket21D68F7E8 | |
INSTANCE: InstanceC1063A87 | |
SECURITY_GROUP: SecurityGroupDD263621 | |
KEY_PAIR: KeyPair | |
INSTANCE_PROFILE: InstanceInstanceProfileAB5AEF02 | |
ROLE: Role1ABCC5F0 | |
DYNAMO_TABLE: DynamoDbTable6316879D | |
- name: Delete test stacks | |
if: matrix.rust-toolchain == 'stable' | |
run: | | |
make test-reset | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
report-status: | |
name: success | |
if: ${{ ! failure() }} | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- name: Report success | |
run: echo 'Success' |