Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cdk checks #2520

Merged
merged 5 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/selfish-items-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
17 changes: 12 additions & 5 deletions .github/actions/build_with_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ description: builds the source code if cache miss and caches the result
inputs:
node-version:
required: true
cdk-version:
cdk-lib-version:
required: true
cdk-cli-version:
required: true
runs:
using: composite
Expand All @@ -14,8 +16,12 @@ runs:
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.cdk-version }}" ]; then
echo "CDK version must be provided"
if [ -z "${{ inputs.cdk-lib-version }}" ]; then
echo "CDK Lib version must be provided"
exit 1;
fi
if [ -z "${{ inputs.cdk-cli-version }}" ]; then
echo "CDK CLI version must be provided"
exit 1;
fi
if [ -z "${{ inputs.node-version }}" ]; then
Expand All @@ -25,13 +31,14 @@ runs:
- uses: ./.github/actions/install_with_cache
with:
node-version: ${{ inputs.node-version }}
cdk-version: ${{ inputs.cdk-version }}
cdk-lib-version: ${{ inputs.cdk-lib-version }}
cdk-cli-version: ${{ inputs.cdk-cli-version }}
# cache build output based on commit sha
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # version 4.2.0
id: build-cache
with:
path: '**/lib'
key: ${{ github.sha }}-node${{ inputs.node-version }}-cdk${{ inputs.cdk-version }}
key: ${{ github.sha }}-node${{ inputs.node-version }}-cdklib${{ inputs.cdk-lib-version }}-cdkcli${{ inputs.cdk-cli-version }}
enableCrossOsArchive: true
# only build if cache miss
- if: steps.build-cache.outputs.cache-hit != 'true'
Expand Down
24 changes: 17 additions & 7 deletions .github/actions/install_with_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ description: installs node_modules if cache miss and stores in the cache
inputs:
node-version:
required: true
cdk-version:
cdk-lib-version:
required: true
cdk-cli-version:
required: true
runs:
using: composite
Expand All @@ -14,8 +16,12 @@ runs:
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.cdk-version }}" ]; then
echo "CDK version must be provided"
if [ -z "${{ inputs.cdk-lib-version }}" ]; then
echo "CDK Lib version must be provided"
exit 1;
fi
if [ -z "${{ inputs.cdk-cli-version }}" ]; then
echo "CDK CLI version must be provided"
exit 1;
fi
if [ -z "${{ inputs.node-version }}" ]; then
Expand All @@ -29,14 +35,18 @@ runs:
path: |
node_modules
packages/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}-cdk${{ inputs.cdk-version }}
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}-cdklib${{ inputs.cdk-lib-version }}-cdkcli${{ inputs.cdk-cli-version }}
# only install if cache miss
- if: steps.npm-cache.outputs.cache-hit != 'true'
shell: bash
run: |
npm ci
if [[ ${{ inputs.cdk-version }} != 'FROM_PACKAGE_LOCK' ]]; then
echo "Installing CDK version ${{ inputs.cdk-version }}"
npm install --no-save aws-cdk@${{ inputs.cdk-version }} aws-cdk-lib@${{ inputs.cdk-version }}
if [[ ${{ inputs.cdk-lib-version }} != 'FROM_PACKAGE_LOCK' ]]; then
echo "Installing CDK Lib version ${{ inputs.cdk-lib-version }}"
npm install --no-save aws-cdk-lib@${{ inputs.cdk-lib-version }}
fi
if [[ ${{ inputs.cdk-cli-version }} != 'FROM_PACKAGE_LOCK' ]]; then
echo "Installing CDK Lib version ${{ inputs.cdk-cli-version }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "Installing CDK CLI version" right

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, that's copy-paste error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm install --no-save aws-cdk@${{ inputs.cdk-cli-version }}
npx cdk --version
fi
17 changes: 12 additions & 5 deletions .github/actions/restore_build_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ inputs:
node-version:
description: node version used to configure environment with
required: true
cdk-version:
cdk-lib-version:
required: true
cdk-cli-version:
required: true
runs:
using: composite
Expand All @@ -15,8 +17,12 @@ runs:
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.cdk-version }}" ]; then
echo "CDK version must be provided"
if [ -z "${{ inputs.cdk-lib-version }}" ]; then
echo "CDK Lib version must be provided"
exit 1;
fi
if [ -z "${{ inputs.cdk-cli-version }}" ]; then
echo "CDK CLI version must be provided"
exit 1;
fi
if [ -z "${{ inputs.node-version }}" ]; then
Expand All @@ -26,12 +32,13 @@ runs:
- uses: ./.github/actions/restore_install_cache
with:
node-version: ${{ inputs.node-version }}
cdk-version: ${{ inputs.cdk-version }}
cdk-lib-version: ${{ inputs.cdk-lib-version }}
cdk-cli-version: ${{ inputs.cdk-cli-version }}
# restore build output from cache
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # version 4.2.0
id: build-cache
with:
path: '**/lib'
key: ${{ github.sha }}-node${{ inputs.node-version }}-cdk${{ inputs.cdk-version }}
key: ${{ github.sha }}-node${{ inputs.node-version }}-cdklib${{ inputs.cdk-lib-version }}-cdkcli${{ inputs.cdk-cli-version }}
fail-on-cache-miss: true
enableCrossOsArchive: true
14 changes: 10 additions & 4 deletions .github/actions/restore_install_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ inputs:
node-version:
description: node version used to configure environment with
required: true
cdk-version:
cdk-lib-version:
required: true
cdk-cli-version:
required: true
runs:
using: composite
Expand All @@ -15,8 +17,12 @@ runs:
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.cdk-version }}" ]; then
echo "CDK version must be provided"
if [ -z "${{ inputs.cdk-lib-version }}" ]; then
echo "CDK Lib version must be provided"
exit 1;
fi
if [ -z "${{ inputs.cdk-cli-version }}" ]; then
echo "CDK CLI version must be provided"
exit 1;
fi
if [ -z "${{ inputs.node-version }}" ]; then
Expand All @@ -30,5 +36,5 @@ runs:
path: |
node_modules
packages/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}-cdk${{ inputs.cdk-version }}
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}-cdklib${{ inputs.cdk-lib-version }}-cdkcli${{ inputs.cdk-cli-version }}
fail-on-cache-miss: true
10 changes: 7 additions & 3 deletions .github/actions/run_with_e2e_account/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ inputs:
fresh_build:
description: Whether should build from scratch
default: false
cdk-version:
cdk-lib-version:
required: true
cdk-cli-version:
required: true
runs:
using: composite
Expand All @@ -35,13 +37,15 @@ runs:
if: inputs.fresh_build != 'true'
uses: ./.github/actions/restore_build_cache
with:
cdk-version: ${{ inputs.cdk-version }}
cdk-lib-version: ${{ inputs.cdk-lib-version }}
cdk-cli-version: ${{ inputs.cdk-cli-version }}
node-version: ${{ inputs.node_version }}
- name: Build With Cache
if: inputs.fresh_build == 'true'
uses: ./.github/actions/build_with_cache
with:
cdk-version: ${{ inputs.cdk-version }}
cdk-lib-version: ${{ inputs.cdk-lib-version }}
cdk-cli-version: ${{ inputs.cdk-cli-version }}
node-version: ${{ inputs.node_version }}
- name: Link CLI
if: inputs.link_cli == 'true'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/canary_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
node_version: 18
# Use version from package lock. Tests projects are created outside of repository root
# and are using latest CDK version.
cdk-version: FROM_PACKAGE_LOCK
cdk-lib-version: FROM_PACKAGE_LOCK
cdk-cli-version: FROM_PACKAGE_LOCK
aws_region: ${{ matrix.region }}
fresh_build: true
shell: bash
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/deprecate_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
- uses: ./.github/actions/install_with_cache
with:
node-version: 18
cdk-version: FROM_PACKAGE_LOCK
cdk-lib-version: FROM_PACKAGE_LOCK
cdk-cli-version: FROM_PACKAGE_LOCK
deprecate_release:
needs:
- install
Expand All @@ -57,6 +58,7 @@ jobs:
- uses: ./.github/actions/restore_install_cache
with:
node-version: 18
cdk-version: FROM_PACKAGE_LOCK
cdk-lib-version: FROM_PACKAGE_LOCK
cdk-cli-version: FROM_PACKAGE_LOCK
- name: Deprecate release versions
run: npx tsx scripts/deprecate_release.ts
3 changes: 2 additions & 1 deletion .github/workflows/e2e_resource_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
- uses: ./.github/actions/install_with_cache
with:
node-version: 18
cdk-version: FROM_PACKAGE_LOCK
cdk-lib-version: FROM_PACKAGE_LOCK
cdk-cli-version: FROM_PACKAGE_LOCK
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # version 4.0.2
with:
Expand Down
Loading
Loading