-
Notifications
You must be signed in to change notification settings - Fork 4
166 lines (166 loc) · 6.06 KB
/
build.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
name: build
on:
pull_request: {}
workflow_call: {}
jobs:
unit-tests:
runs-on: ubuntu-latest
env:
CI: "true"
CLEAN_UP_STACK: "1"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: Run tests
run: pnpm test
deploy-runtime:
concurrency: pr-test-runtime
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
env:
CI: "true"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::593491530938:role/githubActionStack-githubactionroleA106E4DC-14SHKLVA61IN4
aws-region: us-east-1
role-duration-seconds: 3600
- name: Deploy Runtime Tests
run: pnpm -r --filter tests-runtime run deploy:runtime
env:
EVENTUAL_LOCAL: "1"
- name: Upload deployment output as artifact
uses: actions/upload-artifact@v3
with:
name: deployment-output
path: ./apps/tests/aws-runtime/cdk.out/outputs.json
test-runtime:
needs: [deploy-runtime]
concurrency: pr-test-runtime
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::593491530938:role/githubActionStack-githubactionroleA106E4DC-14SHKLVA61IN4
aws-region: us-east-1
role-duration-seconds: 3600
- name: Download artifact with variable
id: deployment-output
uses: actions/download-artifact@v3
with:
name: deployment-output
path: deployment
- run: |
echo "TEST_ROLE_ARN=$(node -p 'JSON.parse(require("fs").readFileSync("${{ steps.deployment-output.outputs.download-path }}/outputs.json"))["eventual-tests"].roleArn')" >> $GITHUB_ENV
- name: Configure Test Role Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: ${{ env.TEST_ROLE_ARN }}
aws-region: us-east-1
role-duration-seconds: 3600
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ env.AWS_SESSION_TOKEN }}
role-skip-session-tagging: true
role-session-name: ${{ github.job }}
- name: Run Runtime Tests
run: pnpm -r --filter tests-runtime run test:runtime
env:
OUTPUTS_FILE: "${{ steps.deployment-output.outputs.download-path }}/outputs.json"
test-local:
needs: [deploy-runtime]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::593491530938:role/githubActionStack-githubactionroleA106E4DC-14SHKLVA61IN4
aws-region: us-east-1
role-duration-seconds: 3600
- name: Download artifact with variable
id: deployment-output
uses: actions/download-artifact@v3
with:
name: deployment-output
path: deployment
- run: |
echo "TEST_ROLE_ARN=$(node -p 'JSON.parse(require("fs").readFileSync("${{ steps.deployment-output.outputs.download-path }}/outputs.json"))["eventual-tests"].roleArn')" >> $GITHUB_ENV
- name: Configure Test Role Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: ${{ env.TEST_ROLE_ARN }}
aws-region: us-east-1
role-duration-seconds: 3600
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ env.AWS_SESSION_TOKEN }}
role-skip-session-tagging: true
role-session-name: ${{ github.job }}
- name: Run Local Tests
run: pnpm -r --filter tests-runtime run test:local-start
test-cli:
needs: [test-runtime]
runs-on: ubuntu-latest
env:
CI: "true"
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::593491530938:role/githubActionStack-githubactionroleA106E4DC-14SHKLVA61IN4
aws-region: us-east-1
role-duration-seconds: 3600
- name: Download artifact with variable
id: deployment-output
uses: actions/download-artifact@v3
with:
name: deployment-output
path: deployment
- run: |
echo "TEST_ROLE_ARN=$(node -p 'JSON.parse(require("fs").readFileSync("${{ steps.deployment-output.outputs.download-path }}/outputs.json"))["eventual-tests"].roleArn')" >> $GITHUB_ENV
- name: Configure Test Role Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: ${{ env.TEST_ROLE_ARN }}
aws-region: us-east-1
role-duration-seconds: 3600
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ env.AWS_SESSION_TOKEN }}
role-skip-session-tagging: true
role-session-name: ${{ github.job }}
- name: Run CLI Tests
run: pnpm -r --filter tests-runtime run test:cli
test-create:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
env:
CI: "true"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: Run Create Tests
run: pnpm -r --filter tests-runtime run test:create