Skip to content

Commit 976a289

Browse files
committed
Split CI for app and IaC
1 parent 31d9d7f commit 976a289

File tree

2 files changed

+91
-83
lines changed

2 files changed

+91
-83
lines changed

.github/workflows/ci-app.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI / App
2+
3+
on:
4+
pull_request:
5+
branches: [dev, stg, prd]
6+
types: [opened, reopened, synchronize, edited]
7+
paths:
8+
- 'src/**'
9+
- '.github/workflows/ci-app.yml'
10+
11+
env:
12+
node_version: "22.x"
13+
FORCE_COLOR: 3
14+
15+
jobs:
16+
test:
17+
name: Test
18+
timeout-minutes: 3
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ env.node_version }}
27+
cache: npm
28+
cache-dependency-path: '**/package-lock.json'
29+
30+
- name: npm ci
31+
working-directory: src
32+
run: npm ci --prefer-offline
33+
34+
- name: npm test
35+
working-directory: src
36+
run: npm test
37+
38+
- name: Report test coverage to Codecov
39+
uses: codecov/codecov-action@v3
40+
if: env.CODECOV_TOKEN
41+
env:
42+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
43+
44+
audit:
45+
name: Audit
46+
timeout-minutes: 3
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Set up Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: ${{ env.node_version }}
55+
56+
# We don't need to install deps to audit them
57+
58+
- name: npm audit
59+
working-directory: src
60+
run: npm audit --audit-level=critical
61+
62+
lint:
63+
name: Lint
64+
timeout-minutes: 3
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Set up Node.js
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: ${{ env.node_version }}
73+
cache: npm
74+
cache-dependency-path: '**/package-lock.json'
75+
76+
- name: npm ci
77+
working-directory: src
78+
run: npm ci --prefer-offline
79+
80+
- name: npm lint
81+
working-directory: src
82+
run: npm run lint
Lines changed: 9 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
name: CI
1+
name: CI / IaC
22

33
on:
44
pull_request:
55
branches: [dev, stg, prd]
66
types: [opened, reopened, synchronize, edited]
7-
paths-ignore:
8-
- 'README.md'
9-
- 'LICENSE'
10-
- '.gitignore'
7+
paths:
8+
- 'terraform-iac/**'
9+
- '.github/workflows/ci-iac.yml'
10+
1111
env:
1212
node_version: "22.x"
1313
tf_version: "1.9.8" # must match value in terraform-iac/*/app/main.tf
14-
FORCE_COLOR: 3
1514

1615
jobs:
1716
env:
@@ -55,12 +54,12 @@ jobs:
5554
{
5655
"tf_working_dir":"./terraform-iac/prd/app",
5756
"aws_account":"539738229445",
58-
"aws_gha_role":"hw-lambda-api-prd-gha"
57+
"aws_gha_role":"hw-lambda-api-cpy-gha"
5958
},
6059
{
6160
"tf_working_dir":"./terraform-iac/cpy/app",
6261
"aws_account":"539738229445",
63-
"aws_gha_role":"hw-lambda-api-cpy-gha"
62+
"aws_gha_role":"hw-lambda-api-prd-gha"
6463
}
6564
]
6665
}'
@@ -69,82 +68,10 @@ jobs:
6968
outputs:
7069
matrix: ${{ env.matrix }}
7170

72-
test:
73-
name: Test
74-
runs-on: ubuntu-latest
75-
timeout-minutes: 3
76-
steps:
77-
- uses: actions/checkout@v4
78-
79-
- name: Set up Node.js
80-
uses: actions/setup-node@v4
81-
with:
82-
node-version: ${{ env.node_version }}
83-
cache: npm
84-
cache-dependency-path: '**/package-lock.json'
85-
86-
- name: npm ci
87-
working-directory: src
88-
run: npm ci --prefer-offline
89-
90-
- name: npm test
91-
working-directory: src
92-
run: npm test
93-
94-
- name: Report test coverage to Codecov
95-
uses: codecov/codecov-action@v5
96-
if: env.CODECOV_TOKEN
97-
env:
98-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
99-
100-
audit:
101-
name: Audit
102-
runs-on: ubuntu-latest
103-
timeout-minutes: 3
104-
steps:
105-
- uses: actions/checkout@v4
106-
107-
- name: Set up Node.js
108-
uses: actions/setup-node@v4
109-
with:
110-
node-version: ${{ env.node_version }}
111-
112-
# We don't need to install deps to audit them
113-
114-
- name: npm audit
115-
working-directory: src
116-
run: npm audit --audit-level=critical
117-
118-
lint:
119-
name: Lint
120-
runs-on: ubuntu-latest
121-
timeout-minutes: 3
122-
steps:
123-
- uses: actions/checkout@v4
124-
125-
- name: Set up Node.js
126-
uses: actions/setup-node@v4
127-
with:
128-
node-version: ${{ env.node_version }}
129-
cache: npm
130-
cache-dependency-path: '**/package-lock.json'
131-
132-
- name: npm ci
133-
working-directory: src
134-
run: npm ci --prefer-offline
135-
136-
- name: npm lint
137-
working-directory: src
138-
run: npm run lint
139-
14071
format:
14172
name: Terraform Format
14273
timeout-minutes: 3
14374
runs-on: ubuntu-latest
144-
needs: env
145-
strategy:
146-
matrix: ${{ fromJson(needs.env.outputs.matrix) }}
147-
fail-fast: false
14875
steps:
14976
- uses: actions/checkout@v4
15077

@@ -154,11 +81,11 @@ jobs:
15481
terraform_version: ${{ env.tf_version }}
15582

15683
- name: Terraform Format
157-
working-directory: "./"
84+
working-directory: terraform-iac
15885
run: terraform fmt -check -recursive
15986

16087
plan:
161-
name: Terraform Plan
88+
name: Terraform Plan / ${{ matrix.env.environment_name }}
16289
timeout-minutes: 6
16390
runs-on: ubuntu-latest
16491
needs: env
@@ -220,4 +147,3 @@ jobs:
220147
terraform-plan-file: plan
221148
divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }}
222149
divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }}
223-

0 commit comments

Comments
 (0)