-
Notifications
You must be signed in to change notification settings - Fork 57
200 lines (178 loc) · 5.93 KB
/
continuous-integration.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
name: Continuous Integration
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
types: [checks_requested]
workflow_run:
workflows: ["Package"]
branches: [main]
types:
- completed
env:
BASE_URL: https://${{ github.event.pull_request.number || 'main' }}.development.scrumlr.fra.ics.inovex.io
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
test-frontend:
name: Build and Test – Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build client
run: |
yarn install
CI=false yarn build
- name: Lint code
run: yarn lint --max-warnings 0
- name: Test with coverage
run: yarn test --coverage --watchAll=false --passWithNoTests
test-backend:
name: Build and Test – Backend
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.22"
cache: false
- name: Cache Go Modules
id: cache-go-modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('server/src/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download Go Modules
if: steps.cache-go-modules.outputs.cache-hit != 'true'
working-directory: ./server/src
run: go mod download
- name: Verify Go Modules
working-directory: ./server/src
run: go list -m all
- name: Go lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.54
working-directory: ./server/src/
- name: Build server
working-directory: ./server
run: |
make test
make build-alpine
package:
needs: [test-frontend, test-backend]
uses: ./.github/workflows/package.yml
deploy_to_dev_cluster:
needs: package
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' || github.ref_name == 'main' }}
uses: ./.github/workflows/deploy_to_dev_cluster.yml
secrets: inherit
with:
frontend_image_tag: ${{ needs.package.outputs.frontend-image-tag }}
server_image_tag: ${{ needs.package.outputs.server-image-tag }}
docs_changes:
if : ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: paths-filter
id: docs_changes
uses: dorny/paths-filter@v3
with:
filters: |
docs:
- 'docs/**'
- name: set-output
id: set-output
run: echo "docs_changed=${{ steps.docs_changes.outputs.docs }}" >> $GITHUB_OUTPUT
outputs:
docs_changed: ${{ steps.set-output.outputs.docs_changed }}
deploy_github_pages:
needs: docs_changes
if: ${{ needs.docs_changes.outputs.docs_changed == 'true' }}
uses: ./.github/workflows/deploy_docs.yml
secrets: inherit
deployment_health_check:
needs: deploy_to_dev_cluster
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' || github.ref_name == 'main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Reachability check
uses: ./.github/actions/deployment_health_check
with:
HEALTH_URL: ${{ env.BASE_URL }}/api/health
postman_tests:
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' }}
needs: deployment_health_check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Reachability check
uses: ./.github/actions/deployment_health_check
with:
HEALTH_URL: ${{ env.BASE_URL }}/api/health
- name: Postman run
uses: ./.github/actions/postman_run
with:
POSTMAN_URL: ${{ env.BASE_URL }}/api
octomind_end_to_end_test:
name: Octomind End to End Test
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' }}
needs: deployment_health_check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Reachability check
uses: ./.github/actions/deployment_health_check
with:
HEALTH_URL: ${{ env.BASE_URL }}/api/health
- name: Run tests
uses: OctoMind-dev/automagically-action-execute@v2
with:
url: https://${{ github.event.pull_request.number }}.development.scrumlr.fra.ics.inovex.io
token: ${{ secrets.AUTOMAGICALLY_TOKEN }}
testTargetId: ${{ secrets.AUTOMAGICALLY_TEST_TARGET_ID }}
cypress_end_to_end_test:
name: Cypress End to End Test
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' }}
needs: deployment_health_check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Start server
run: docker compose --profile build up -d
working-directory: server
- name: Setup client and run tests
uses: cypress-io/github-action@v6
with:
browser: chrome
start: |
yarn install
yarn run start
working-directory: ./
wait-on: 'http://localhost:3000'