-
Notifications
You must be signed in to change notification settings - Fork 347
62 lines (59 loc) · 2.39 KB
/
run-integration-test.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
name: Run integration tests
permissions:
id-token: write
contents: read
on:
workflow_dispatch:
push:
jobs:
run-integration-tests:
runs-on: ubuntu-latest
steps:
- name: install Cargo Lambda
uses: jaxxstorm/[email protected]
with:
repo: cargo-lambda/cargo-lambda
platform: linux
arch: x86_64
- name: install Zig toolchain
uses: korandoru/setup-zig@v1
with:
zig-version: 0.10.0
- name: install SAM
uses: aws-actions/setup-sam@v2
with:
use-installer: true
- uses: actions/checkout@v3
- name: configure aws credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ secrets.ROLE_SESSION_NAME }}
aws-region: ${{ secrets.AWS_REGION }}
- name: build stack
run: cd lambda-integration-tests && sam build --beta-features
- name: validate stack
run: cd lambda-integration-tests && sam validate --lint
- name: deploy stack
id: deploy_stack
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
run: |
cd lambda-integration-tests
stackName="aws-lambda-rust-integ-test-$GITHUB_RUN_ID"
echo "STACK_NAME=$stackName" >> "$GITHUB_OUTPUT"
echo "Stack name = $stackName"
sam deploy --stack-name "${stackName}" --parameter-overrides "ParameterKey=SecretToken,ParameterValue=${{ secrets.SECRET_TOKEN }}" "ParameterKey=LambdaRole,ParameterValue=${{ secrets.AWS_LAMBDA_ROLE }}" --no-confirm-changeset --no-progressbar > disable_output
TEST_ENDPOINT=$(sam list stack-outputs --stack-name "${stackName}" --output json | jq -r '.[] | .OutputValue')
echo "TEST_ENDPOINT=$TEST_ENDPOINT" >> "$GITHUB_OUTPUT"
- name: run test
env:
SECRET_TOKEN: ${{ secrets.SECRET_TOKEN }}
TEST_ENDPOINT: ${{ steps.deploy_stack.outputs.TEST_ENDPOINT }}
run: cd lambda-integration-tests && cargo test
- name: cleanup
if: always()
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
STACK_NAME: ${{ steps.deploy_stack.outputs.STACK_NAME }}
run: sam delete --stack-name "${STACK_NAME}" --no-prompts