-
Notifications
You must be signed in to change notification settings - Fork 13
151 lines (126 loc) · 3.86 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
name: Commit
on:
pull_request:
push:
branches:
- master
repository_dispatch:
types:
- radar-release
jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./.scripts/python_requirements.txt
- name: Yaml lint
run: python .scripts/yaml_lint.py
- name: Verify schema
run: python .scripts/yaml_validate.py
test:
runs-on: ubuntu-latest
needs:
- yamllint
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: NPM install
run: |
npm ci
npm ci --prefix server
- name: Lint javascript
run: |
npm run lint:js -- \
--format junit \
--output-file test-results/eslint/TEST-eslint.xml
npm run lint:js --prefix=server -- \
--format junit \
--output-file test-results/eslint/TEST-eslint.xml
- name: Unit tests
run: |
npm test -- --ci --coverage
npm test --prefix server -- --ci --coverage
- name: Build radar
run: npm run build
- name: SonarCloud Scan
uses: extenda/actions/sonar-scanner@v0
with:
sonar-host: https://sonarcloud.io
service-account-key: ${{ secrets.SECRET_AUTH }}
release:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs:
- yamllint
- test
outputs:
docker-image-name: ${{ steps.docker-publish.outputs.docker-image-name }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: extenda/actions/gcp-secret-manager@v0
with:
service-account-key: ${{ secrets.SECRET_AUTH }}
secrets: |
ORG_TOKEN: github-token
- uses: extenda/actions/gcp-secret-manager@v0
with:
service-account-key: ${{ secrets.GCLOUD_AUTH }}
secrets: |
LD_CLIENT_ID: launchdarkly-client-id
- name: Checkout IT & BIS radar repository
uses: actions/checkout@v2
with:
token: ${{ env.ORG_TOKEN }}
repository: extenda/it-bis-radar
path: .it-bis_radar
- name: Copy IT & BIS radar
run: mv .it-bis_radar/radar radar_it
- name: Create release
uses: extenda/actions/conventional-release@v0
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NPM install
run: |
npm ci
npm ci --prefix server
- name: Build radar
run: |
npm version ${{ steps.release.outputs.version }} --no-git-tag-version
npm version ${{ steps.release.outputs.version }} --no-git-tag-version --prefix server
npm run build
- uses: extenda/actions/setup-gcloud@v0
id: gcloud
with:
service-account-key: ${{ secrets.GCLOUD_AUTH }}
- name: Publish Docker image
id: docker-publish
run: |
gcloud auth configure-docker --quiet
IMAGE=gcr.io/${{ steps.gcloud.outputs.project-id }}/tech-radar:${{ steps.release.outputs.release-tag }}
echo "::set-output name=docker-image-name::$IMAGE"
docker build -t $IMAGE .
docker push $IMAGE
deploy:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs:
- release
steps:
- uses: actions/checkout@v2
- uses: extenda/actions/setup-gcloud@v0
id: gcloud
with:
service-account-key: ${{ secrets.GCLOUD_AUTH }}
- name: Deploy to Cloud Run
uses: extenda/actions/cloud-run@v0
with:
service-account-key: ${{ secrets.GCLOUD_AUTH }}
image: ${{ needs.release.outputs.docker-image-name }}