-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (43 loc) · 1.42 KB
/
terraform_cypress.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
name: Deploy with Terraform and Test API with Cypress
on:
push:
branches: [main]
env:
REGION: ${{ secrets.AWS_REGION }}
IAM_ROLE: ${{ secrets.AWS_BACKEND_ASSUME_ROLE_ARN }} # this is a IAM role in AWS account store as secret in github account
# permission can be added at job level or workflow level
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
terraform-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS Credentials with GitHub OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.REGION }}
role-to-assume: ${{ env.IAM_ROLE }}
role-session-name: my-github-actions-session
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
- name: Update Infra with Terraform
run: |
terraform init
terraform plan -out plan.tfplan
terraform apply -auto-approve plan.tfplan
cypress-tests:
needs: terraform-deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Cypress run
uses: cypress-io/github-action@v6