This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
forked from extenda/actions
-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (178 loc) · 5.65 KB
/
commit.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
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
name: Commit
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12
- name: Cache node modules
uses: actions/cache@v1
id: cache
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install dependencies
run: npm ci
- name: Lint Javascript
run: |
npm run lint:js
- name: Run tests
run: |
echo "::stop-commands::jest-output"
npm test -- --ci
echo "::jest-output::"
env:
NEXUS_USERNAME: ${{secrets.NEXUS_USERNAME}}
NEXUS_PASSWORD: ${{secrets.NEXUS_PASSWORD}}
- name: Check compiled dist/* files
run: |
npm run build
git add "*/dist/**"
if [ -n "$(git diff-index --exit-code HEAD '*/dist/**')" ]; then
echo ""
echo "::error::Found uncommitted changes to compiled javascripts."
echo ""
git diff-index --stat HEAD '*/dist/**'
echo ""
echo "::error::Did you remember to run 'npm run build'?"
exit 1
fi
- name: Analyze with SonarCloud
uses: ./sonar-scanner
with:
sonar-host: https://sonarcloud.io
service-account-key: ${{ secrets.SECRET_AUTH }}
- name: Analyze with SonarQube
uses: ./sonar-scanner
with:
sonar-host: https://sonar.extenda.io
service-account-key: ${{ secrets.SECRET_AUTH }}
acceptance-windows:
runs-on: windows-latest
needs: test
steps:
- uses: actions/checkout@v2
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 }}
acceptance-linux:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
- name: Install Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Run Maven (no POM)
uses: ./maven
with:
args: --version
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
- name: Run Maven CLI
run: mvn dependency:get -Dartifact=se.extenda.maven:commonpom:2.5.1:pom
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
- name: GCP Secret Manager
uses: ./gcp-secret-manager
with:
service-account-key: ${{ secrets.SECRET_AUTH }}
secrets: |
TEST_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
- 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 }}
- name: Get test token
uses: ./iam-test-token
with:
service-account-key: ${{ secrets.SECRET_AUTH }}
- name: Test IAM token
run: |
curl -sSi "https://iam-api.retailsvc.com/api/v1/permissions/iam.tenant.create" -H "Authorization: Bearer $IAM_TOKEN"
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs:
- test
- acceptance-windows
- acceptance-linux
steps:
- uses: actions/checkout@v1
- name: Create release
uses: ./conventional-release
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 [email protected]
git push origin $releaseBranch --force