Skip to content

Commit eb38a8c

Browse files
committed
matrix generation
1 parent 97cad6e commit eb38a8c

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ on:
77
pull_request:
88
branches:
99
- main
10-
schedule:
11-
- cron: '0 5 * * *' # once daily at 5AM
1210
workflow_dispatch:
1311
inputs:
14-
cdk-version:
15-
description: Upstream aws-cdk version to use in tests
12+
node-version:
1613
required: false
14+
default: '22.x'
15+
python-version:
16+
required: false
17+
default: '3.12'
1718

1819
env:
1920
AWS_ACCESS_KEY_ID: test
@@ -22,31 +23,41 @@ env:
2223
AWS_DEFAULT_REGION: us-east-1
2324

2425
jobs:
25-
dynamic-cdk-version-testing:
26+
generate-cdk-version-matrix:
2627
runs-on: ubuntu-latest
27-
28+
outputs:
29+
matrix: ${{ steps.set-matrix.env.MATRIX }}
30+
steps:
31+
- name: Use Node.js ${{ inputs.node-version }}
32+
uses: actions/setup-node@v2
33+
with:
34+
node-version: ${{ inputs.node-version }}
35+
- name: Obtain aws-cdk versions
36+
id: set-matrix
37+
run: |
38+
VERSIONS_ARRAY=$(npm show aws-cdk time --json --silent| jq 'del(.created, .modified) | keys' -c)
39+
echo "MATRIX={\"cdk-version\":$( echo "$VERSIONS_ARRAY" )}" >> $GITHUB_ENV
40+
41+
version-testing:
42+
runs-on: ubuntu-latest
43+
needs: generate-cdk-version-matrix
2844
strategy:
29-
matrix:
30-
node-version: ['22.x']
31-
python-version: ['3.12']
32-
cdk-version: ${{ fromJson(inputs.cdk-version || '["2.166.0","2.167.0", ""]') }}
33-
fail-fast: False
34-
45+
matrix: ${{fromJson(needs.generate-cdk-version-matrix.outputs.matrix)}}
3546

3647
steps:
3748
- uses: actions/checkout@v2
3849
with:
3950
path: repo
4051

41-
- name: Use Node.js ${{ matrix.node-version }}
52+
- name: Use Node.js ${{ inputs.node-version }}
4253
uses: actions/setup-node@v2
4354
with:
44-
node-version: ${{ matrix.node-version }}
55+
node-version: ${{ inputs.node-version }}
4556

46-
- name: Setup Python ${{ matrix.python-version }}
57+
- name: Setup Python ${{ inputs.python-version }}
4758
uses: actions/setup-python@v2
4859
with:
49-
python-version: '${{ matrix.python-version }}'
60+
python-version: '${{ inputs.python-version }}'
5061

5162
- name: Install dependencies for aws-cdk-local
5263
working-directory: repo

0 commit comments

Comments
 (0)