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