Skip to content

Commit ce958cf

Browse files
authored
ci: deploy, test, and delete capacity provider functions separately (#421)
*Issue #, if available:* *Description of changes:* Capacity provider functions take up capacity in the account, which causes problems if we have multiple PRs open, since the deployment will fail for the capacity provider functions. This PR separates capacity provider functions into separate steps and ensures we always delete them after every run. This makes it harder to debug any potential issues however, but it would be better to deploy those to your personal account for that. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent fdaed29 commit ce958cf

File tree

3 files changed

+233
-67
lines changed

3 files changed

+233
-67
lines changed

.github/workflows/integration-tests.yml

Lines changed: 128 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ jobs:
5252
GITHUB_EVENT_NAME: ${{ github.event_name }}
5353
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
5454
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
55-
CAPACITY_PROVIDER_ARN: ${{ secrets.CAPACITY_PROVIDER_ARN }}
5655
run: node .github/workflows/scripts/integration-test/integration-test.js --deploy-only --runtime ${{ inputs.node-version }}
5756

5857
jest-integration-test:
@@ -96,6 +95,133 @@ jobs:
9695
LAMBDA_ENDPOINT: ${{ secrets.LAMBDA_ENDPOINT }}
9796
GITHUB_EVENT_NAME: ${{ github.event_name }}
9897
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
99-
CAPACITY_PROVIDER_ARN: ${{ secrets.CAPACITY_PROVIDER_ARN }}
10098
run: |
10199
node .github/workflows/scripts/integration-test/integration-test.js --test-only --runtime ${{ inputs.node-version }}
100+
101+
deploy-capacity-provider:
102+
permissions:
103+
contents: read
104+
id-token: write # Required for AWS credentials
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v4
108+
109+
- name: Setup Node.js
110+
uses: actions/setup-node@v4
111+
with:
112+
node-version: ${{ inputs.node-version }}
113+
cache: "npm"
114+
115+
- name: Get AWS Credentials
116+
id: credentials
117+
if: github.actor != 'nektos/act'
118+
uses: aws-actions/configure-aws-credentials@v4
119+
with:
120+
role-to-assume: "${{ secrets.ACTIONS_INTEGRATION_ROLE_NAME }}"
121+
role-session-name: githubIntegrationTest
122+
aws-region: ${{ vars.AWS_REGION }}
123+
124+
- name: Download build artifacts
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: built-artifacts
128+
path: .
129+
130+
- name: Install dependencies
131+
run: npm ci
132+
133+
- name: Deploy all capacity provider functions
134+
id: deploy-capacity-providers
135+
env:
136+
LAMBDA_ENDPOINT: ${{ secrets.LAMBDA_ENDPOINT }}
137+
GITHUB_EVENT_NAME: ${{ github.event_name }}
138+
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
139+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
140+
CAPACITY_PROVIDER_ARN: ${{ secrets.CAPACITY_PROVIDER_ARN }}
141+
run: node .github/workflows/scripts/integration-test/integration-test.js --deploy-only --capacity-provider-only --runtime ${{ inputs.node-version }}
142+
143+
test-capacity-provider:
144+
needs: deploy-capacity-provider
145+
runs-on: ubuntu-latest
146+
name: Test Capacity Provider Functions
147+
permissions:
148+
contents: read
149+
id-token: write # Required for AWS credentials
150+
151+
steps:
152+
- uses: actions/checkout@v4
153+
154+
- name: Setup Node.js
155+
uses: actions/setup-node@v4
156+
with:
157+
node-version: ${{ inputs.node-version }}
158+
cache: "npm"
159+
160+
- name: Get AWS Credentials
161+
id: credentials
162+
if: github.actor != 'nektos/act'
163+
uses: aws-actions/configure-aws-credentials@v4
164+
with:
165+
role-to-assume: "${{ secrets.ACTIONS_INTEGRATION_ROLE_NAME }}"
166+
role-session-name: githubIntegrationTest
167+
aws-region: ${{ vars.AWS_REGION }}
168+
169+
- name: Download build artifacts
170+
uses: actions/download-artifact@v4
171+
with:
172+
name: built-artifacts
173+
path: .
174+
175+
- name: Install dependencies
176+
run: npm ci
177+
178+
- name: Test all capacity provider functions
179+
env:
180+
LAMBDA_ENDPOINT: ${{ secrets.LAMBDA_ENDPOINT }}
181+
GITHUB_EVENT_NAME: ${{ github.event_name }}
182+
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
183+
run: |
184+
node .github/workflows/scripts/integration-test/integration-test.js --test-only --capacity-provider-only --runtime ${{ inputs.node-version }}
185+
cleanup-capacity-provider:
186+
if: always()
187+
needs: test-capacity-provider
188+
runs-on: ubuntu-latest
189+
name: Clean up capacity provider functions
190+
permissions:
191+
contents: read
192+
id-token: write # Required for AWS credentials
193+
194+
steps:
195+
- uses: actions/checkout@v4
196+
197+
- name: Setup Node.js
198+
uses: actions/setup-node@v4
199+
with:
200+
node-version: ${{ inputs.node-version }}
201+
cache: "npm"
202+
203+
- name: Get AWS Credentials
204+
id: credentials
205+
if: github.actor != 'nektos/act'
206+
uses: aws-actions/configure-aws-credentials@v4
207+
with:
208+
role-to-assume: "${{ secrets.ACTIONS_INTEGRATION_ROLE_NAME }}"
209+
role-session-name: githubIntegrationTest
210+
aws-region: ${{ vars.AWS_REGION }}
211+
212+
- name: Download build artifacts
213+
uses: actions/download-artifact@v4
214+
with:
215+
name: built-artifacts
216+
path: .
217+
218+
- name: Install dependencies
219+
run: npm ci
220+
221+
- name: Clean up capacity provider functions
222+
env:
223+
LAMBDA_ENDPOINT: ${{ secrets.LAMBDA_ENDPOINT }}
224+
GITHUB_EVENT_NAME: ${{ github.event_name }}
225+
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
226+
run: |
227+
node .github/workflows/scripts/integration-test/integration-test.js --cleanup-only --capacity-provider-only --runtime ${{ inputs.node-version }}

0 commit comments

Comments
 (0)