-
Notifications
You must be signed in to change notification settings - Fork 25
176 lines (168 loc) · 6.46 KB
/
canaries.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Canaries
on:
schedule:
- cron: '*/30 * * * *' # Run every 30m
workflow_dispatch:
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
release-canary:
runs-on: ubuntu-latest
steps:
- name: Checkout Studio Codegen
uses: actions/checkout@v2
with:
path: amplify-codegen-ui
- name: Setup Node.js LTS
uses: actions/setup-node@v2
with:
node-version: lts/*
- name: Install Latest Amplfy CLI
run: npm i -g @aws-amplify/cli@latest
- name: Create a test react app
run: npx create-react-app e2e-test-app
- name: Install test app dependencies
working-directory: e2e-test-app
run: |
npm i aws-amplify@^5.0.0 @aws-amplify/ui-react@^5.0.0
npm i --save-dev cypress
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.E2E_TEST_ROLE_ARN }}
aws-region: us-west-2
- name: Create temp AWS credentials file
working-directory: e2e-test-app
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID && \
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY && \
aws configure set aws_session_token $AWS_SESSION_TOKEN && \
aws configure set default.region $AWS_REGION
- name: Run CLI Pull in test app
working-directory: e2e-test-app
run: |
FORCE_RENDER=1 amplify pull --appId ${{ secrets.E2E_TEST_APP_ID }} --envName staging -y --providers "{\
\"awscloudformation\":{\
\"configLevel\":\"project\",\
\"useProfile\":true,\
\"profileName\":\"default\",\
}\
}"
- name: Write test files
working-directory: e2e-test-app
run: cp -r ../amplify-codegen-ui/packages/test-generator/e2e-test-templates/. .
- name: Cypress run
uses: cypress-io/github-action@v2
with:
working-directory: e2e-test-app
install: false
start: npm start
wait-on: 'http://localhost:3000'
wait-on-timeout: 120
config-file: cypress.config.js
env:
REACT_APP_USER_EMAIL: ${{ secrets.E2E_TEST_USER_EMAIL }}
REACT_APP_USER_PASSWORD: ${{ secrets.E2E_TEST_USER_PASSWORD }}
write-release-canary-failure-metric:
runs-on: ubuntu-latest
needs: release-canary
if: ${{ failure() }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.CANARY_METRIC_ROLE_ARN }}
aws-region: us-west-2
- run: aws cloudwatch put-metric-data --metric-name ReleaseSuccessRate --namespace CodegenUiCanaries --value 0
write-release-canary-success-metric:
runs-on: ubuntu-latest
needs: release-canary
if: ${{ success() }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.CANARY_METRIC_ROLE_ARN }}
aws-region: us-west-2
- run: aws cloudwatch put-metric-data --metric-name ReleaseSuccessRate --namespace CodegenUiCanaries --value 1
release-canary-v6:
runs-on: ubuntu-latest
steps:
- name: Checkout Studio Codegen
uses: actions/checkout@v2
with:
path: amplify-codegen-ui
- name: Setup Node.js LTS
uses: actions/setup-node@v2
with:
node-version: lts/*
- name: Install Latest Amplfy CLI
run: npm i -g @aws-amplify/cli@latest
- name: Create a test react app
run: npx create-react-app e2e-test-app
- name: Install test app dependencies
working-directory: e2e-test-app
run: |
npm i aws-amplify@^6.0.0 @aws-amplify/ui-react@^6.0.0
npm i --save-dev cypress
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.E2E_TEST_ROLE_ARN }}
aws-region: us-west-2
- name: Create temp AWS credentials file
working-directory: e2e-test-app
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID && \
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY && \
aws configure set aws_session_token $AWS_SESSION_TOKEN && \
aws configure set default.region $AWS_REGION
- name: Run CLI Pull in test app
working-directory: e2e-test-app
run: |
FORCE_RENDER=1 amplify pull --appId ${{ secrets.E2E_TEST_APP_ID }} --envName staging -y --providers "{\
\"awscloudformation\":{\
\"configLevel\":\"project\",\
\"useProfile\":true,\
\"profileName\":\"default\",\
}\
}"
- name: Write test files
working-directory: e2e-test-app
run: cp -r ../amplify-codegen-ui/packages/test-generator/e2e-test-templates-amplify-js-v6/. .
- name: Cypress run
uses: cypress-io/github-action@v2
with:
working-directory: e2e-test-app
install: false
start: npm start
wait-on: 'http://localhost:3000'
wait-on-timeout: 120
config-file: cypress.config.js
env:
REACT_APP_USER_EMAIL: ${{ secrets.E2E_TEST_USER_EMAIL }}
REACT_APP_USER_PASSWORD: ${{ secrets.E2E_TEST_USER_PASSWORD }}
write-release-canary-v6-failure-metric:
runs-on: ubuntu-latest
needs: release-canary-v6
if: ${{ failure() }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.CANARY_METRIC_ROLE_ARN }}
aws-region: us-west-2
- run: aws cloudwatch put-metric-data --metric-name ReleaseSuccessRate --namespace CodegenUiCanaries --value 0
write-release-canary-v6-success-metric:
runs-on: ubuntu-latest
needs: release-canary-v6
if: ${{ success() }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.CANARY_METRIC_ROLE_ARN }}
aws-region: us-west-2
- run: aws cloudwatch put-metric-data --metric-name ReleaseSuccessRate --namespace CodegenUiCanaries --value 1