-
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 1.78 KB
/
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
63
64
65
66
67
68
69
70
71
72
73
74
name: Integration Test
on:
push:
branches-ignore:
- main
env:
TF_VAR_project: ${{ secrets.GCLOUD_PROJECT }}
jobs:
terraform:
name: Create test CR
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.5.7
- name: lint
run: terraform fmt *.tf modules/*/*.tf
shell: bash
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
version: 'latest'
- name: Authenticate to Google Cloud
id: 'auth'
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.GCLOUD_OIDC_POOL }}
service_account: ${{ secrets.GSA }}
token_format: 'access_token'
- name: Configure gcloud
run: |
gcloud config set project ${{ secrets.GCLOUD_PROJECT }}
gcloud config set disable_prompts true
- uses: 'docker/login-action@v3'
name: 'Docker login'
with:
registry: 'us-docker.pkg.dev'
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
- name: terraform init
run: terraform init -upgrade
working-directory: ./test
- name : pick a region, any region
run: terraform apply -target random_shuffle.region -auto-approve
working-directory: ./test
- name: terraform apply
run: terraform apply -auto-approve
working-directory: ./test
- name: run tests
run: ./test.sh
working-directory: ./test
- name: terraform destroy
run: terraform destroy -auto-approve
working-directory: ./test