Skip to content

Commit

Permalink
chore: test for Node 20, set default to node 16 (#4126)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
RomainMuller and mergify[bot] authored Jun 8, 2023
1 parent 1bf8f79 commit f880d50
Show file tree
Hide file tree
Showing 34 changed files with 192 additions and 258 deletions.
51 changes: 11 additions & 40 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ jobs:
id-token: write # Necessary for OIDC federation
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['14', '16', '18']
node: ['14', '16', '18', '20']
env:
# Node version whose images will be aliased without the -nodeXX segment
DEFAULT_NODE_MAJOR_VERSION: 14
DEFAULT_NODE_MAJOR_VERSION: 16
steps:
- name: Check out
uses: actions/checkout@v3
Expand All @@ -33,25 +34,25 @@ jobs:
run: |-
if [ "${{ github.event_name }}" = "push" ]; then
echo '⏯ Triggered by "push" event'
echo "::set-output name=result::true"
echo "result=true" >> $GITHUB_OUTPUT
elif [ "${{ github.base_ref }}" = "release" ]; then
echo '⏯ Triggered by "pull_request" event against "release"'
echo "::set-output name=result::true"
echo "result=true" >> $GITHUB_OUTPUT
else
# Fetch the base and head refs from origin so we can safely diff 'em
git fetch --depth=1 --quiet origin ${{ github.base_ref }}
# Otherwise, only run if the Dockerfile changed
changed=$(git diff --name-only origin/${{ github.base_ref }}..HEAD)
if grep Dockerfile <<< "${changed}" ; then
echo '⏯ Dockerfile changed'
echo "::set-output name=result::true"
echo "result=true" >> $GITHUB_OUTPUT
else
if grep '.github/workflows/docker-images.yml' <<< "${changed}" ; then
echo '⏯ docker-images workflow changed'
echo "::set-output name=result::true"
echo "result=true" >> $GITHUB_OUTPUT
else
echo '⏭ Dockerfile not changed'
echo "::set-output name=result::false"
echo "result=false" >> $GITHUB_OUTPUT
fi
fi
fi
Expand All @@ -65,10 +66,10 @@ jobs:
run: |-
if [[ "${{ secrets.AWS_ROLE_TO_ASSUME }}" != "" ]]; then
echo "🔑 Federation into AWS is possible (AWS_ROLE_TO_ASSUME is available)"
echo "::set-output name=enabled::true"
echo "enabled=true" >> $GITHUB_OUTPUT
else
echo "❌ Federation into AWS is disabled (no AWS_ROLE_TO_ASSUME secret found)"
echo "::set-output name=enabled::false"
echo "enabled=false" >> $GITHUB_OUTPUT
fi
# Federate into the PR Validation AWS Account
Expand Down Expand Up @@ -114,17 +115,6 @@ jobs:
[worker.oci]
max-parallelism = 1
# We only restore GH cache if we are not going to publish the result (i.e: PR validation)
- name: Set up layer cache
if: steps.should-run.outputs.result == 'true' && github.event_name != 'push'
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('superchain/*') }}-${{ github.sha }}
restore-keys: |-
${{ runner.os }}-buildx-${{ hashFiles('superchain/*') }}-
${{ runner.os }}-buildx-
# 1 pull per second from ECR Public
- name: Jitter the start time to avoid ECR Public throttling
id: sleep-start
Expand All @@ -136,7 +126,7 @@ jobs:
id: build-time
if: steps.should-run.outputs.result == 'true'
run: |-
echo "::set-output name=value::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
echo "value=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Build Image
if: steps.should-run.outputs.result == 'true'
Expand All @@ -145,8 +135,6 @@ jobs:
--builder ${{ steps.buildx.outputs.name }} \
--platform linux/amd64,linux/arm64 \
--target superchain \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache-out \
--pull \
--build-arg BUILD_TIMESTAMP="${{ steps.build-time.outputs.value }}" \
--build-arg COMMIT_ID='${{ github.sha }}' \
Expand All @@ -161,8 +149,6 @@ jobs:
--builder ${{ steps.buildx.outputs.name }} \
--platform linux/amd64,linux/arm64 \
--target superchain \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache \
--build-arg BUILD_TIMESTAMP="${{ steps.build-time.outputs.value }}" \
--build-arg COMMIT_ID='${{ github.sha }}' \
--build-arg NODE_MAJOR_VERSION=${{ matrix.node }} \
Expand Down Expand Up @@ -194,8 +180,6 @@ jobs:
--builder ${{ steps.buildx.outputs.name }} \
--platform linux/amd64,linux/arm64 \
--target superchain \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache \
--push \
--build-arg BUILD_TIMESTAMP="${{ steps.build-time.outputs.value }}" \
--build-arg COMMIT_ID='${{ github.sha }}' \
Expand All @@ -211,8 +195,6 @@ jobs:
--builder ${{ steps.buildx.outputs.name }} \
--platform linux/amd64,linux/arm64 \
--target superchain \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache \
--push \
--build-arg BUILD_TIMESTAMP="${{ steps.build-time.outputs.value }}" \
--build-arg COMMIT_ID='${{ github.sha }}' \
Expand All @@ -233,8 +215,6 @@ jobs:
--builder ${{ steps.buildx.outputs.name }} \
--platform linux/amd64,linux/arm64 \
--target superchain \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache \
--push \
--build-arg BUILD_TIMESTAMP="${{ steps.build-time.outputs.value }}" \
--build-arg COMMIT_ID='${{ github.sha }}' \
Expand All @@ -250,8 +230,6 @@ jobs:
--builder ${{ steps.buildx.outputs.name }} \
--platform linux/amd64,linux/arm64 \
--target superchain \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache \
--push \
--build-arg BUILD_TIMESTAMP="${{ steps.build-time.outputs.value }}" \
--build-arg COMMIT_ID='${{ github.sha }}' \
Expand All @@ -261,10 +239,3 @@ jobs:
-f superchain/Dockerfile \
.
fi
# Replace the cache so it does not grow forever (should always be last!)
- name: Update layer cache
if: always() && steps.should-run.outputs.result == 'true'
run: |-
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-out /tmp/.buildx-cache
69 changes: 41 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ jobs:
with:
distribution: 'zulu'
java-version: '8'
- name: Set up Node 14
- name: Set up Node 16
uses: actions/setup-node@v3
with:
cache: yarn
node-version: '14'
node-version: '16'
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -124,11 +124,11 @@ jobs:
with:
distribution: 'zulu'
java-version: '8'
- name: Set up Node 14
- name: Set up Node 16
uses: actions/setup-node@v3
with:
cache: yarn
node-version: '14'
node-version: '16'
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
dotnet: ['6.0.x']
go: ['1.18']
java: ['8']
node: ['14'] # EOL 2023-04-30
node: ['16'] # EOL 2023-09-11
os: [ubuntu-latest]
python: ['3.7']
# Add specific combinations to be tested against "node 14" (to restrict cardinality)
Expand All @@ -205,15 +205,15 @@ jobs:
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '14'
node: '16'
python: '3.7'
# Test using macOS
- title: 'macOS'
os: macos-latest
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '14'
node: '16'
python: '3.7'
# Test alternate Nodes
- title: 'Node 16'
Expand All @@ -230,35 +230,35 @@ jobs:
node: '18' # EOL 2025-04-30
os: ubuntu-latest
python: '3.7'
- title: 'Node 19'
- title: 'Node 20'
java: '8'
dotnet: '6.0.x'
go: '1.18'
node: '19' # EOL 2023-06-01
node: '20' # EOL 2026-04-30
os: ubuntu-latest
python: '3.7'
# Test alternate .NETs
- title: '.NET 7.0'
java: '8'
dotnet: '7.0.x'
go: '1.18'
node: '14'
node: '16'
os: ubuntu-latest
python: '3.7'
# Test alternate Gos
- title: 'Go 1.19'
java: '8'
dotnet: '6.0.x'
go: '1.19'
node: '14'
node: '16'
os: ubuntu-latest
python: '3.7'
# Test alternate Javas
- title: 'Java 11'
java: '11'
dotnet: '6.0.x'
go: '1.18'
node: '14'
node: '16'
os: ubuntu-latest
python: '3.7'
# Test alternate Pythons
Expand All @@ -267,28 +267,28 @@ jobs:
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '14'
node: '16'
os: ubuntu-latest
- title: 'Python 3.9'
python: '3.9'
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '14'
node: '16'
os: ubuntu-latest
- title: 'Python 3.10'
python: '3.10'
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '14'
node: '16'
os: ubuntu-latest
- title: 'Python 3.11'
python: '3.11'
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '14'
node: '16'
os: ubuntu-latest

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -365,6 +365,16 @@ jobs:
&& echo "Untracked files: ${untracked:-<none>}" \
&& test -z "${untracked}"
shell: bash

test-ok:
name: Unit Tests
runs-on: ubuntu-latest
needs: test
steps:
- name: OK
# This is just a join target to simplify branch protection setup
run: echo OK

benchmark:
name: Run benchmark suite
runs-on: ubuntu-latest
Expand Down Expand Up @@ -427,27 +437,27 @@ jobs:
name: release-package
path: ${{ runner.temp }}/release-package
# Set up all of our standard runtimes
- name: Set up .NET 6
- name: Set up .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Set up Go 1.18
dotnet-version: '7.0.x'
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up Java 8
go-version: '1.20'
- name: Set up Java 20
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'
- name: Set up Node 14
distribution: 'corretto'
java-version: '20'
- name: Set up Node 20
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Set up Python 3.7
node-version: '20'
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.11'
- name: Install python3-venv
run: sudo apt install -y python3-venv
# Show time!
Expand All @@ -457,8 +467,11 @@ jobs:
${{ runner.temp }}/release-package/js/*.tgz \
${{ runner.temp }}/release-package/private/*.tgz
- name: Run jsii-pacmak on aws-cdk-lib
env:
NODE_OPTIONS: --max-old-space-size=6144
# We run with --no-parallel to avoid running out of memory...
run: |-
./node_modules/.bin/jsii-pacmak ./node_modules/aws-cdk-lib
./node_modules/.bin/jsii-pacmak --no-parallel ./node_modules/aws-cdk-lib
# Upload artifact (we'll tar it up to save time)
- name: 'Upload Artifact: integtest_aws-cdk-lib'
uses: actions/upload-artifact@v3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ jobs:
id: monorepo-packages
# These need to be ignored from the `ncu` runs!
run: |-
echo -n "::set-output name=list::"
node -p "$(lerna ls --all --json 2>/dev/null).map(item => item.name).join(',')"
echo -n "list=" >> $GITHUB_OUTPUT
node -p "$(lerna ls --all --json 2>/dev/null).map(item => item.name).join(',')" >> $GITHUB_OUTPUT
- name: Identify production dependencies
id: production-dependencies
# These should be limited to `--target=minor` in the `ncu` run
# We assume repository-root has no production dependencies (it shouldn't have any!)
# We always consider @types/node to be a production dependency (it must relate to our minimum supported engine)
run: |-
echo -n "::set-output name=list::"
node -p <<-EOF
echo -n "list=" >> $GITHUB_OUTPUT
node -p <<-EOF >> $GITHUB_OUTPUT
const path = require('path');
const prodDependencies = new Set(['@types/node']);
Expand Down
Loading

0 comments on commit f880d50

Please sign in to comment.