-
Notifications
You must be signed in to change notification settings - Fork 12
260 lines (220 loc) · 6.83 KB
/
commit.yml
File metadata and controls
260 lines (220 loc) · 6.83 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
permissions: write-all
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./.github/actions/build-dist
- name: Lint Javascript
run: npm run lint:js
- name: Read secrets used by tests
uses: ./gcp-secret-manager
with:
service-account-key: ${{ secrets.SECRET_AUTH }}
secrets: |
NEXUS_USERNAME: nexus-username
NEXUS_PASSWORD: nexus-password
- name: Configure git short-sha length for tests
run: |
echo "Before: $(git rev-parse --short HEAD)"
git config core.abbrev 7
echo "After: $(git rev-parse --short HEAD)"
- name: Run tests
run: |
echo "::stop-commands::`echo -n "$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER" | sha256sum | head -c 64`"
npm test
echo "::`echo -n "$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER" | sha256sum | head -c 64`::"
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 25
- name: Analyze with SonarCloud
uses: ./sonar-scanner
with:
sonar-host: https://sonarcloud.io
service-account-key: ${{ secrets.SECRET_AUTH }}
verify-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/build-dist
- name: Check compiled dist/* files
run: |
git add '*/dist/**'
if [ "$(git diff --staged --ignore-space-at-eol '*/dist/**' | wc -l)" -gt "0" ]; then
echo ""
echo "::error::Found uncommitted changes to compiled javascripts."
echo ""
git diff --staged '*/dist/**'
echo ""
echo "::error::Did you remember to run 'npm run build'?"
exit 1
fi
acceptance-windows:
runs-on: windows-2025
needs:
- verify-dist
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./setup-msbuild
- name: Assert MSBuild exists on PATH
run: where MSBuild.exe
- name: Run MSBuild
run: MSBuild -version
- name: Setup Terraform
uses: ./setup-terraform
with:
terraform-version: 0.12.24
terragrunt-version: 0.23.3
- name: Test Terragrunt
run: terragrunt -version
- name: Conventional version
uses: ./conventional-version
id: version
- name: Print version
run: |
echo VERSION=${{ steps.version.outputs.version }}
echo RELEASE_TAG=${{ steps.version.outputs.release-tag }}
- name: GCP Secret Manager
uses: ./gcp-secret-manager
with:
service-account-key: ${{ secrets.SECRET_AUTH }}
secrets: |
TEST_TOKEN: sonarqube-token
TEST2_TOKEN: sonarqube-token
- name: Assert GCP secrets
shell: bash
run: |
if [ -n "$TEST_TOKEN" ]; then
echo "Secret successfully set to env"
else
echo "Failed to set secret to env"
exit 1
fi
if [ "$TEST_TOKEN" = "$TEST2_TOKEN" ]; then
echo "Secret matches expectation"
else
echo "Second secret does not match"
exit 1
fi
acceptance-linux:
name: ${{ matrix.job-name }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
job-name: [acceptance-linux]
runs-on: ${{ matrix.os }}
needs:
- verify-dist
steps:
- uses: actions/checkout@v6
- name: Install Java
uses: actions/setup-java@v5
with:
distribution: adopt
java-version: 11
- name: Run Maven (no POM)
uses: ./maven
with:
args: --version
service-account-key: ${{ secrets.SECRET_AUTH }}
- name: Run Maven action dependency:get from Nexus
uses: ./maven
with:
args: dependency:get -Dartifact=se.extenda.maven:commonpom:2.5.1:pom
service-account-key: ${{ secrets.SECRET_AUTH }}
- name: Run Maven CLI
run: mvn dependency:get -Dartifact=se.extenda.maven:commonpom:2.5.1:pom
- name: GCP Secret Manager
uses: ./gcp-secret-manager
with:
service-account-key: ${{ secrets.SECRET_AUTH }}
secrets: |
TEST_TOKEN: sonarqube-token
TEST2_TOKEN: sonarqube-token
- name: Assert GCP secrets
run: |
if [ -n "$TEST_TOKEN" ]; then
echo "Secret successfully set to env"
else
echo "Failed to set secret to env"
exit 1
fi
if [ "$TEST_TOKEN" = "$TEST2_TOKEN" ]; then
echo "Secret matches expectation"
else
echo "Second secret does not match"
exit 1
fi
- name: Setup Gcloud
uses: ./setup-gcloud
id: gcloud
with:
service-account-key: ${{ secrets.SECRET_AUTH }}
- name: Test Gcloud
run: |
gcloud --version
gsutil --version
if [ "${{ steps.gcloud.outputs.project-id }}" == "" ]; then
echo "Failed to set project-id"
exit 1
fi
- name: Setup Terraform
uses: ./setup-terraform
with:
terraform-version: 0.11.14
terragrunt-version: 0.23.3
- name: Test Terraform
run: |
terraform -version
if [[ "$(terraform -version)" != *"v0.11.14"* ]]; then
echo "Did not find expected terraform v0.11.14"
which -a terraform
exit 1
fi
terragrunt -version
- name: Conventional version
uses: ./conventional-version
id: version
- name: Print version
run: |
echo VERSION=${{ steps.version.outputs.version }}
echo RELEASE_TAG=${{ steps.version.outputs.release-tag }}
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs:
- test
- verify-dist
- acceptance-windows
- acceptance-linux
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Create release
uses: ./conventional-release
with:
name: Actions
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update release branch
run: |
releaseBranch=$(echo "${{ steps.release.outputs.release-tag }}" | tr "." " " | awk '{print $1}')
git checkout -B $releaseBranch ${{ steps.release.outputs.release-tag }}
git config --add user.name "GitHub Actions"
git config --add user.email devops@extendaretail.com
git push origin $releaseBranch --force