forked from openkfw/TruBudget
-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (165 loc) · 4.93 KB
/
github-ci.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
name: Test/Build CI
on:
push:
branches:
- main
- 2.x.x-release
pull_request:
release:
types: [ published ]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install danger
run: npm ci
- name: Run danger and create github comment if necessary
run: npm run danger ci
lint:
runs-on: ubuntu-latest
needs: danger
strategy:
matrix:
node-version: [ 18.x ]
project: [ frontend, api, blockchain, provisioning ]
defaults:
run:
working-directory: ${{ matrix.project }}
steps:
- uses: actions/checkout@v2
- uses: ./.github/workflows/lint
audit:
runs-on: ubuntu-latest
needs: [ danger, lint ]
strategy:
matrix:
node-version: [ 18.x ]
project:
[
frontend,
api,
blockchain,
provisioning,
e2e-test,
excel-export-service,
email-notification-service,
storage-service,
logging-service,
migration
]
defaults:
run:
working-directory: ${{ matrix.project }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: ./.github/workflows/audit
test:
runs-on: ubuntu-latest
needs: [ danger, lint, audit ]
strategy:
matrix:
node-version: [ 18.x ]
project: [ frontend, api ]
defaults:
run:
working-directory: ${{ matrix.project }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --legacy-peer-deps
- name: Check for Changes in ${{ matrix.project }}
uses: marceloprado/has-changed-path@v1
id: run-test
with:
paths: ${{ matrix.project }}
- name: Test
if: steps.run-test.outputs.changed == 'true'
uses: ./.github/workflows/test
build:
runs-on: ubuntu-latest
needs: [ danger, lint, audit, test ]
strategy:
matrix:
project:
[
frontend,
api,
blockchain,
provisioning,
e2e-test,
excel-export-service,
email-notification-service,
storage-service,
logging-service,
migration
]
include:
- project: frontend
image_name: trubudget/frontend
- project: api
image_name: trubudget/api
- project: blockchain
image_name: trubudget/blockchain
- project: provisioning
image_name: trubudget/provisioning
- project: e2e-test
image_name: trubudget/e2e-test
- project: excel-export-service
image_name: trubudget/excel-export
- project: email-notification-service
image_name: trubudget/email-notification
- project: storage-service
image_name: trubudget/storage-service
- project: logging-service
image_name: trubudget/logging-service
- project: migration
image_name: trubudget/migration
defaults:
run:
working-directory: ${{ matrix.project }}
env:
GITHUB_PR_NUMBER: ${{ github.event.number}}
GITHUB_BASE_REF: ${{ github.base_ref}}
GITHUB_HEAD_REF: ${{ github.head_ref}}
PRIVATE_REGISTRY: ${{ secrets.PRIVATE_REGISTRY}}
PRIVATE_REGISTRY_BASE: ${{ secrets.PRIVATE_REGISTRY_BASE}}
PRIVATE_REGISTRY_USERNAME: ${{ secrets.PRIVATE_REGISTRY_USERNAME}}
PRIVATE_REGISTRY_PASSWORD: ${{ secrets.PRIVATE_REGISTRY_PASSWORD}}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD}}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME}}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD}}
IMAGE_NAME: ${{ matrix.image_name}}
steps:
- uses: actions/checkout@v2
- uses: docker-practice/actions-setup-docker@master
- uses: ./.github/workflows/build
notification:
runs-on: ubuntu-latest
needs: [ lint, test, danger, audit, build ]
env:
GITHUB_BASE_REF: ${{ github.base_ref}}
GITHUB_HEAD_REF: ${{ github.head_ref}}
GITHUB_PR_NUMBER: ${{ github.event.number}}
WEBHOOK_TOKEN: ${{ secrets.WEBHOOK_TOKEN }}
WEBHOOK_REF: ${{ secrets.WEBHOOK_REF_2 }}
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
steps:
- uses: actions/checkout@v2
- uses: ./.github/workflows/notification