-
Notifications
You must be signed in to change notification settings - Fork 468
50 lines (47 loc) · 1.49 KB
/
test-cloudformation.yaml
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
name: Test - CloudFormation
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
permissions:
id-token: write
contents: read
jobs:
test:
if: github.repository == 'aws-samples/eks-workshop-v2'
name: run-tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set cluster ID
env:
RUN_ID: "${{ github.job }}"
AWS_REGION: "${{ secrets.AWS_REGION }}"
run: |
CLUSTER_ID=$(echo $RANDOM | md5sum | head -c 8)
echo "Using cluster ID ${CLUSTER_ID}"
echo "CLUSTER_ID=$CLUSTER_ID" >> $GITHUB_ENV
- name: Set branch name
run: echo "TEST_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
- name: Get AWS credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-duration-seconds: 3600
aws-region: ${{ secrets.AWS_REGION }}
role-session-name: GithubActionsSession-${{ env.CLUSTER_ID }}
- name: Deploy
id: deploy
env:
AWS_REGION: "${{ secrets.AWS_REGION }}"
CLUSTER_ID: "${{ env.CLUSTER_ID }}"
run: |
make deploy-ide environment="${CLUSTER_ID}"
- name: Cleanup
if: always()
env:
AWS_REGION: "${{ secrets.AWS_REGION }}"
CLUSTER_ID: "${{ env.CLUSTER_ID }}"
run: |
make destroy-ide environment="${CLUSTER_ID}"