Skip to content

Commit

Permalink
Test latest cdk deeply. (#2333)
Browse files Browse the repository at this point in the history
* parameter

* try this

* try this

* try this

* try this

* try this

* try this

* boop

* does this work ?

* try this

* Comment.

* try this

* try this

* this

* Revert "this"

This reverts commit 9493955.

* this

* this

* this

* more

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* try this

* comment

* make node version required

* fix that

* fix that

* try this

* try this

* try this

* fix that

* remove from canaries

* that

* that

* that

* try this
  • Loading branch information
sobolk authored Dec 16, 2024
1 parent 9fee057 commit 1400e6f
Show file tree
Hide file tree
Showing 19 changed files with 482 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .changeset/good-jokes-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
23 changes: 21 additions & 2 deletions .github/actions/build_with_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,36 @@ name: build_with_cache
description: builds the source code if cache miss and caches the result
inputs:
node-version:
default: 18
required: true
cdk-version:
required: true
runs:
using: composite
steps:
# Validate that non-blank inputs are provided.
# This is to ensure that inputs are plumbed and not defaulted accidentally in action call chains.
# The 'required' input property does not assert this if value is provided at runtime.
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.cdk-version }}" ]; then
echo "CDK version must be provided"
exit 1;
fi
if [ -z "${{ inputs.node-version }}" ]; then
echo "Node version must be provided"
exit 1;
fi
- uses: ./.github/actions/install_with_cache
with:
node-version: ${{ inputs.node-version }}
cdk-version: ${{ inputs.cdk-version }}
# cache build output based on commit sha
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # version 4.0.2
id: build-cache
with:
path: '**/lib'
key: ${{ github.sha }}-node${{ inputs.node-version }}
key: ${{ github.sha }}-node${{ inputs.node-version }}-cdk${{ inputs.cdk-version }}
enableCrossOsArchive: true
# only build if cache miss
- if: steps.build-cache.outputs.cache-hit != 'true'
Expand Down
28 changes: 25 additions & 3 deletions .github/actions/install_with_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,41 @@ name: install_with_cache
description: installs node_modules if cache miss and stores in the cache
inputs:
node-version:
default: 18
required: true
cdk-version:
required: true
runs:
using: composite
steps:
# Validate that non-blank inputs are provided.
# This is to ensure that inputs are plumbed and not defaulted accidentally in action call chains.
# The 'required' input property does not assert this if value is provided at runtime.
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.cdk-version }}" ]; then
echo "CDK version must be provided"
exit 1;
fi
if [ -z "${{ inputs.node-version }}" ]; then
echo "Node version must be provided"
exit 1;
fi
# cache node_modules based on package-lock.json hash
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # version 4.0.2
id: npm-cache
with:
path: |
node_modules
packages/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}-cdk${{ inputs.cdk-version }}
# only install if cache miss
- if: steps.npm-cache.outputs.cache-hit != 'true'
shell: bash
run: npm ci
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 }}
npx cdk --version
fi
23 changes: 21 additions & 2 deletions .github/actions/restore_build_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,35 @@ description: composes restoring node_modules and restoring build artifacts
inputs:
node-version:
description: node version used to configure environment with
default: 18
required: true
cdk-version:
required: true
runs:
using: composite
steps:
# Validate that non-blank inputs are provided.
# This is to ensure that inputs are plumbed and not defaulted accidentally in action call chains.
# The 'required' input property does not assert this if value is provided at runtime.
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.cdk-version }}" ]; then
echo "CDK version must be provided"
exit 1;
fi
if [ -z "${{ inputs.node-version }}" ]; then
echo "Node version must be provided"
exit 1;
fi
- uses: ./.github/actions/restore_install_cache
with:
node-version: ${{ inputs.node-version }}
cdk-version: ${{ inputs.cdk-version }}
# restore build output from cache
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # version 4.0.2
id: build-cache
with:
path: '**/lib'
key: ${{ github.sha }}-node${{ inputs.node-version }}
key: ${{ github.sha }}-node${{ inputs.node-version }}-cdk${{ inputs.cdk-version }}
fail-on-cache-miss: true
enableCrossOsArchive: true
20 changes: 18 additions & 2 deletions .github/actions/restore_install_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,32 @@ description: restores node_modules from the cache and fails if no cache entry fo
inputs:
node-version:
description: node version used to configure environment with
default: 18
required: true
cdk-version:
required: true
runs:
using: composite
steps:
# Validate that non-blank inputs are provided.
# This is to ensure that inputs are plumbed and not defaulted accidentally in action call chains.
# The 'required' input property does not assert this if value is provided at runtime.
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.cdk-version }}" ]; then
echo "CDK version must be provided"
exit 1;
fi
if [ -z "${{ inputs.node-version }}" ]; then
echo "Node version must be provided"
exit 1;
fi
# restore node_modules from cache
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # version 4.0.2
id: npm-cache
with:
path: |
node_modules
packages/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}-cdk${{ inputs.cdk-version }}
fail-on-cache-miss: true
10 changes: 9 additions & 1 deletion .github/actions/run_with_e2e_account/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
required: false
node_version:
description: node version used to configure environment with
required: false
required: true
e2e_test_accounts:
description: Serialized JSON array of strings with account numbers
required: true
Expand All @@ -22,6 +22,8 @@ inputs:
fresh_build:
description: Whether should build from scratch
default: false
cdk-version:
required: true
runs:
using: composite
steps:
Expand All @@ -32,9 +34,15 @@ runs:
- name: Restore Build Cache
if: inputs.fresh_build != 'true'
uses: ./.github/actions/restore_build_cache
with:
cdk-version: ${{ inputs.cdk-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 }}
node-version: ${{ inputs.node_version }}
- name: Link CLI
if: inputs.link_cli == 'true'
shell: bash
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/setup_baseline_version/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: setup_baseline_version
description: Set up a baseline or "previous" version of the library for testing. Mostly useful for backwards compatibility
inputs:
node_version:
description: node version used to configure environment with
required: true
outputs:
baseline_dir:
description: 'Path where baseline project directory is setup'
Expand Down Expand Up @@ -35,6 +39,8 @@ runs:
with:
ref: ${{ steps.get_baseline_commit_sha.outputs.baseline_commit_sha }}
- uses: ./.github/actions/setup_node
with:
node-version: ${{ inputs.node_version }}
- name: Install and build baseline version
shell: bash
run: |
Expand Down
12 changes: 11 additions & 1 deletion .github/actions/setup_node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ name: setup_node
inputs:
node-version:
description: node version used to configure environment with
default: 18
required: true
runs:
using: composite
steps:
# Validate that non-blank inputs are provided.
# This is to ensure that inputs are plumbed and not defaulted accidentally in action call chains.
# The 'required' input property does not assert this if value is provided at runtime.
- name: Validate input
shell: bash
run: |
if [ -z "${{ inputs.node-version }}" ]; then
echo "Node version must be provided"
exit 1;
fi
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # version 4.0.2
with:
node-version: ${{ inputs.node-version }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/canary_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # version 4.1.4
- uses: ./.github/actions/setup_node
with:
node-version: 18
- name: Install and build without lock file
shell: bash
run: |
Expand Down Expand Up @@ -46,7 +48,10 @@ jobs:
uses: ./.github/actions/run_with_e2e_account
with:
e2e_test_accounts: ${{ vars.E2E_TEST_ACCOUNTS }}
node_version: ${{ matrix.node-version }}
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
aws_region: ${{ matrix.region }}
fresh_build: true
shell: bash
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/deprecate_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ jobs:
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # version 4.1.4
- uses: ./.github/actions/setup_node
with:
node-version: 18
- uses: ./.github/actions/install_with_cache
with:
node-version: 18
cdk-version: FROM_PACKAGE_LOCK
deprecate_release:
needs:
- install
Expand All @@ -47,6 +52,11 @@ jobs:
# fetch full history so that we can properly lookup past releases
fetch-depth: 0
- uses: ./.github/actions/setup_node
with:
node-version: 18
- uses: ./.github/actions/restore_install_cache
with:
node-version: 18
cdk-version: FROM_PACKAGE_LOCK
- name: Deprecate release versions
run: npx tsx scripts/deprecate_release.ts
5 changes: 5 additions & 0 deletions .github/workflows/e2e_resource_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ jobs:
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # version 4.1.4
- uses: ./.github/actions/setup_node
with:
node-version: 18
- uses: ./.github/actions/install_with_cache
with:
node-version: 18
cdk-version: FROM_PACKAGE_LOCK
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # version 4.0.2
with:
Expand Down
Loading

0 comments on commit 1400e6f

Please sign in to comment.