Skip to content

Commit 6090f55

Browse files
add basic regression tests for Node, Go and Python runtimes (#63)
1 parent d12e116 commit 6090f55

6 files changed

+316
-3247
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Integration Tests
1+
name: Build
22

33
on:
44
push:

.github/workflows/integrations.go.yml

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Regression Tests (Go)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
upstream-version:
13+
description: Upstream aws-cdk version to use in tests
14+
required: false
15+
env:
16+
AWS_ACCESS_KEY_ID: test
17+
AWS_SECRET_ACCESS_KEY: test
18+
19+
jobs:
20+
integration-go:
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
matrix:
25+
include:
26+
- { language: go, node-version: '16.x', go-version: '1.16.15', region: us-east-1}
27+
- { language: go, node-version: '16.x', go-version: '1.17.8', region: us-east-1}
28+
- { language: go, node-version: '16.x', go-version: '1.18', region: us-east-1}
29+
30+
env:
31+
AWS_REGION: ${{ matrix.region }}
32+
AWS_DEFAULT_REGION: ${{ matrix.region }}
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
with:
37+
path: repo
38+
39+
- name: Use Node.js ${{ matrix.node-version }}
40+
uses: actions/setup-node@v2
41+
with:
42+
node-version: ${{ matrix.node-version }}
43+
44+
- name: Setup Python 3.10
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: '3.10'
48+
49+
- name: Setup Go ${{ matrix.go-version }}
50+
uses: actions/setup-go@v2
51+
with:
52+
go-version: ${{ matrix.go-version }}
53+
54+
- name: Install dependencies for aws-cdk-local
55+
working-directory: repo
56+
run: |
57+
npm install
58+
npm install aws-cdk
59+
echo "$(pwd)/bin" >> $GITHUB_PATH
60+
61+
- name: Install specific aws-cdk version
62+
working-directory: repo
63+
if: inputs.upstream-version
64+
run: npm install aws-cdk@${{ inputs.upstream-version }}
65+
66+
- name: Verify specific aws-cdk version is used by cdklocal
67+
if: inputs.upstream-version
68+
run: |
69+
[[ $(cdklocal --version) =~ ^${{ inputs.upstream-version }}.* ]] || exit 1
70+
71+
- name: Install localstack CLI
72+
run: pip install localstack
73+
74+
- name: Create temporary directory for test
75+
run: mkdir cdk-test
76+
77+
- name: Initialize new CDK app
78+
working-directory: cdk-test
79+
run: cdklocal init app --language=${{ matrix.language }}
80+
81+
- name: Start and wait for localstack (Community)
82+
timeout-minutes: 10
83+
run: |
84+
docker pull localstack/localstack:latest
85+
localstack start -d
86+
localstack wait -t 30
87+
88+
- name: Install go dependencies
89+
working-directory: cdk-test
90+
run: go get
91+
92+
- name: Run bootstrap
93+
working-directory: cdk-test
94+
timeout-minutes: 1
95+
run: cdklocal bootstrap
96+
97+
- name: Deploy
98+
working-directory: cdk-test
99+
timeout-minutes: 1
100+
run: cdklocal deploy --require-approval=never
101+
102+
- name: Verify successful deployment
103+
run: |
104+
[ $(aws cloudformation describe-stacks --endpoint-url http://localhost:4566 | jq '[ .Stacks[] | select(.StackStatus == "CREATE_COMPLETE") ] | length') -eq 2 ] || exit 1
105+
[ $(aws cloudformation describe-stacks --endpoint-url http://localhost:4566 | jq '[ .Stacks[] | select(.StackStatus == "CREATE_FAILED") ] | length') -eq 0 ] || exit 1
+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Regression Tests (NodeJS)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
upstream-version:
13+
description: Upstream aws-cdk version to use in tests
14+
required: false
15+
env:
16+
AWS_ACCESS_KEY_ID: test
17+
AWS_SECRET_ACCESS_KEY: test
18+
19+
jobs:
20+
integration-nodejs:
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
matrix:
25+
include:
26+
- { language: javascript, node-version: '16.x', region: us-east-1}
27+
- { language: typescript, node-version: '16.x', region: eu-west-2}
28+
- { language: typescript, node-version: '16.x', region: us-east-1}
29+
- { language: typescript, node-version: '14.x', region: us-east-1}
30+
- { language: typescript, node-version: '12.x', region: us-east-1}
31+
32+
env:
33+
AWS_REGION: ${{ matrix.region }}
34+
AWS_DEFAULT_REGION: ${{ matrix.region }}
35+
36+
steps:
37+
- uses: actions/checkout@v2
38+
with:
39+
path: repo
40+
41+
- name: Use Node.js ${{ matrix.node-version }}
42+
uses: actions/setup-node@v2
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
46+
- name: Setup Python 3.10
47+
uses: actions/setup-python@v2
48+
with:
49+
python-version: '3.10'
50+
51+
- name: Install dependencies for aws-cdk-local
52+
working-directory: repo
53+
run: |
54+
npm install
55+
npm install aws-cdk
56+
echo "$(pwd)/bin" >> $GITHUB_PATH
57+
58+
- name: Install specific aws-cdk version
59+
working-directory: repo
60+
if: inputs.upstream-version
61+
run: npm install aws-cdk@${{ inputs.upstream-version }}
62+
63+
- name: Verify specific aws-cdk version is used by cdklocal
64+
if: inputs.upstream-version
65+
run: |
66+
[[ $(cdklocal --version) =~ ^${{ inputs.upstream-version }}.* ]] || exit 1
67+
68+
- name: Install localstack CLI
69+
run: pip install localstack
70+
71+
- name: Create temporary directory for test
72+
run: mkdir cdk-test
73+
74+
- name: Initialize new CDK app
75+
working-directory: cdk-test
76+
run: cdklocal init app --language=${{ matrix.language }}
77+
78+
- name: Start and wait for localstack (Community)
79+
timeout-minutes: 10
80+
run: |
81+
docker pull localstack/localstack:latest
82+
localstack start -d
83+
localstack wait -t 30
84+
85+
- name: Run bootstrap
86+
working-directory: cdk-test
87+
timeout-minutes: 1
88+
run: cdklocal bootstrap
89+
90+
- name: Deploy
91+
working-directory: cdk-test
92+
timeout-minutes: 1
93+
run: cdklocal deploy --require-approval=never
94+
95+
- name: Verify successful deployment
96+
run: |
97+
[ $(aws cloudformation describe-stacks --endpoint-url http://localhost:4566 | jq '[ .Stacks[] | select(.StackStatus == "CREATE_COMPLETE") ] | length') -eq 2 ] || exit 1
98+
[ $(aws cloudformation describe-stacks --endpoint-url http://localhost:4566 | jq '[ .Stacks[] | select(.StackStatus == "CREATE_FAILED") ] | length') -eq 0 ] || exit 1
+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Regression Tests (Python)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
upstream-version:
13+
description: Upstream aws-cdk version to use in tests
14+
required: false
15+
env:
16+
AWS_ACCESS_KEY_ID: test
17+
AWS_SECRET_ACCESS_KEY: test
18+
19+
jobs:
20+
integration-python:
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
matrix:
25+
include:
26+
- { language: python, node-version: '16.x', python-version: '3.10', region: us-east-1}
27+
- { language: python, node-version: '16.x', python-version: '3.9', region: us-east-1}
28+
- { language: python, node-version: '16.x', python-version: '3.8', region: us-east-1}
29+
- { language: python, node-version: '16.x', python-version: '3.7', region: us-east-1}
30+
31+
env:
32+
AWS_REGION: ${{ matrix.region }}
33+
AWS_DEFAULT_REGION: ${{ matrix.region }}
34+
35+
steps:
36+
- uses: actions/checkout@v2
37+
with:
38+
path: repo
39+
40+
- name: Use Node.js ${{ matrix.node-version }}
41+
uses: actions/setup-node@v2
42+
with:
43+
node-version: ${{ matrix.node-version }}
44+
45+
- name: Setup Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v2
47+
with:
48+
python-version: '${{ matrix.python-version }}'
49+
50+
- name: Install dependencies for aws-cdk-local
51+
working-directory: repo
52+
run: |
53+
npm install
54+
npm install aws-cdk
55+
echo "$(pwd)/bin" >> $GITHUB_PATH
56+
57+
- name: Install specific aws-cdk version
58+
working-directory: repo
59+
if: inputs.upstream-version
60+
run: npm install aws-cdk@${{ inputs.upstream-version }}
61+
62+
- name: Verify specific aws-cdk version is used by cdklocal
63+
if: inputs.upstream-version
64+
run: |
65+
[[ $(cdklocal --version) =~ ^${{ inputs.upstream-version }}.* ]] || exit 1
66+
67+
- name: Install localstack CLI
68+
run: pip install localstack
69+
70+
- name: Create temporary directory for test
71+
run: mkdir cdk-test
72+
73+
- name: Initialize new CDK app
74+
working-directory: cdk-test
75+
run: cdklocal init app --language=${{ matrix.language }}
76+
77+
- name: Start and wait for localstack (Community)
78+
timeout-minutes: 10
79+
run: |
80+
docker pull localstack/localstack:latest
81+
localstack start -d
82+
localstack wait -t 30
83+
84+
- name: Install python libs
85+
working-directory: cdk-test
86+
run: |
87+
source .venv/bin/activate
88+
pip install -r requirements.txt
89+
90+
- name: Run bootstrap
91+
working-directory: cdk-test
92+
timeout-minutes: 1
93+
run: |
94+
source .venv/bin/activate
95+
cdklocal bootstrap
96+
97+
- name: Deploy
98+
working-directory: cdk-test
99+
timeout-minutes: 1
100+
run: |
101+
source .venv/bin/activate
102+
cdklocal deploy --require-approval=never
103+
104+
- name: Verify successful deployment
105+
run: |
106+
[ $(aws cloudformation describe-stacks --endpoint-url http://localhost:4566 | jq '[ .Stacks[] | select(.StackStatus == "CREATE_COMPLETE") ] | length') -eq 2 ] || exit 1
107+
[ $(aws cloudformation describe-stacks --endpoint-url http://localhost:4566 | jq '[ .Stacks[] | select(.StackStatus == "CREATE_FAILED") ] | length') -eq 0 ] || exit 1

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# IDE
2+
.idea
3+
14
# Logs
25
logs
36
*.log

0 commit comments

Comments
 (0)