forked from RossBugginsNHS/github-workflow-dispatcher
-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (80 loc) · 2.36 KB
/
ci.yml
File metadata and controls
100 lines (80 loc) · 2.36 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions:
contents: read
jobs:
quality:
name: Build, Lint, Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "22"
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Lint
run: npm run lint
- name: Test
run: npm test
terraform-validate:
name: Terraform Validate
runs-on: ubuntu-latest
needs: quality
permissions:
contents: read
strategy:
fail-fast: false
matrix:
environment: [dev, prod]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
- name: Terraform Init
working-directory: infrastructure/terraform/environments/${{ matrix.environment }}
run: |
cat > backend_override.tf << 'EOF'
terraform {
backend "local" {}
}
EOF
terraform init -reconfigure
- name: Terraform Validate
working-directory: infrastructure/terraform/environments/${{ matrix.environment }}
run: terraform validate
terraform-test:
name: Terraform Test
runs-on: ubuntu-latest
needs: quality
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
- name: Terraform Init
working-directory: infrastructure/terraform/modules/dispatcher_service
run: terraform init -backend=false
- name: Terraform Test
working-directory: infrastructure/terraform/modules/dispatcher_service
run: terraform test