-
Notifications
You must be signed in to change notification settings - Fork 3
244 lines (242 loc) · 13 KB
/
dotnet-core-master.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
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
name: .NET Master
on:
push:
branches: [ master, stable, angular15 ]
paths-ignore:
- '**.md'
jobs:
backend-pn-build:
runs-on: ubuntu-latest
steps:
- name: 'Preparing backend configuration checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-backendconfiguration-plugin
path: eform-backendconfiguration-plugin
- name: Extract branch name
id: extract_branch
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: 'Preparing Frontend checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-angular-frontend
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-frontend
- name: 'Preparing items planning checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-angular-items-planning-plugin
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-items-planning-plugin
- name: 'Preparing time planning checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-angular-timeplanning-plugin
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-timeplanning-plugin
- name: Copy dependencies
run: |
cp -av eform-angular-items-planning-plugin/eform-client/src/app/plugins/modules/items-planning-pn eform-angular-frontend/eform-client/src/app/plugins/modules/items-planning-pn
cp -av eform-angular-timeplanning-plugin/eform-client/src/app/plugins/modules/time-planning-pn eform-angular-frontend/eform-client/src/app/plugins/modules/time-planning-pn
cp -av eform-backendconfiguration-plugin/eform-client/src/app/plugins/modules/backend-configuration-pn eform-angular-frontend/eform-client/src/app/plugins/modules/backend-configuration-pn
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
cd eform-angular-frontend/eform-client && ../../eform-angular-items-planning-plugin/testinginstallpn.sh
../../eform-angular-timeplanning-plugin/testinginstallpn.sh
../../eform-backendconfiguration-plugin/testinginstallpn.sh
- name: Copy Dockerfile
run: cp eform-backendconfiguration-plugin/Dockerfile .
- name: Build the tagged Docker image
run: docker build . -t microtingas/work-items-planning-container:latest -t microtingas/work-items-planning-container:1.0.0 --build-arg GITVERSION=1.0.0 --build-arg PLUGINVERSION=1.0.0 --build-arg PLUGIN2VERSION=1.0.0 --build-arg PLUGIN3VERSION=1.0.0 --build-arg PLUGIN4VERSION=1.0.0 --build-arg PLUGIN5VERSION=1.0.0 --build-arg PLUGIN6VERSION=1.0.0
- name: Tag builds
run: |-
docker tag microtingas/work-items-planning-container:latest microtingas/work-items-planning-container:latest
- run: docker save microtingas/work-items-planning-container:latest -o work-items-planning-container.tar
- uses: actions/upload-artifact@v4
with:
name: work-items-planning-container
path: work-items-planning-container.tar
backend-pn-test:
needs: backend-pn-build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
test: [a,b,c,d,e,f,g,h,i,j]
steps:
- uses: actions/checkout@v3
with:
path: eform-backendconfiguration-plugin
- name: Extract branch name
id: extract_branch
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
name: work-items-planning-container
- run: docker load -i work-items-planning-container.tar
- name: Create docker network
run: docker network create --driver bridge --attachable data
- name: Start MariaDB
run: |
docker pull mariadb:10.8
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:10.8
- name: Start rabbitmq
run: |
docker pull rabbitmq:latest
docker run -d --hostname my-rabbit --name some-rabbit --network data -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=password rabbitmq:latest
- name: Sleep 15
run: sleep 15
- name: Start the newly build Docker container
id: docker-run
run: docker run --name my-container -p 4200:5000 --network data microtingas/work-items-planning-container:latest "/ConnectionString=host=mariadbtest;Database=420_Angular;user=root;password=secretpassword;port=3306;Convert Zero Datetime = true;SslMode=none;" > docker_run_log 2>&1 &
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: 'Preparing Frontend checkout'
uses: actions/checkout@v3
with:
repository: microting/eform-angular-frontend
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-frontend
- name: 'Preparing ItemsPlanning checkout'
uses: actions/checkout@v3
with:
repository: microting/eform-angular-items-planning-plugin
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-items-planning-plugin
- name: Copy dependencies
run: |
cp -av eform-backendconfiguration-plugin/eform-client/src/app/plugins/modules/backend-configuration-pn eform-angular-frontend/eform-client/src/app/plugins/modules/backend-configuration-pn
cp -av eform-backendconfiguration-plugin/eform-client/e2e/Tests/backend-configuration-settings eform-angular-frontend/eform-client/e2e/Tests/backend-configuration-settings
cp -av eform-backendconfiguration-plugin/eform-client/e2e/Tests/backend-configuration-general eform-angular-frontend/eform-client/e2e/Tests/backend-configuration-general
cp -av eform-backendconfiguration-plugin/eform-client/e2e/Page\ objects/BackendConfiguration eform-angular-frontend/eform-client/e2e/Page\ objects/BackendConfiguration
cp -av eform-backendconfiguration-plugin/eform-client/e2e/Assets eform-angular-frontend/eform-client/e2e/
ls -lah /home/runner/work/eform-backendconfiguration-plugin/eform-backendconfiguration-plugin/eform-angular-frontend/eform-client/e2e/Assets
cp -av eform-angular-items-planning-plugin/eform-client/e2e/Page\ objects/ItemsPlanning eform-angular-frontend/eform-client/e2e/Page\ objects/ItemsPlanning
cp -av eform-backendconfiguration-plugin/eform-client/wdio-headless-plugin-step2${{matrix.test}}.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2${{matrix.test}}.conf.ts
cp -av eform-backendconfiguration-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts
mkdir -p eform-angular-frontend/eform-client/cypress/e2e/plugins/
cp -av eform-backendconfiguration-plugin/eform-client/cypress/e2e/plugins/backend-configuration-pn eform-angular-frontend/eform-client/cypress/e2e/plugins/backend-configuration-pn
cp -av eform-backendconfiguration-plugin/eform-client/cypress/fixtures eform-angular-frontend/eform-client/cypress
- name: yarn install
run: cd eform-angular-frontend/eform-client && yarn install
- name: Create errorShots directory
run: mkdir eform-angular-frontend/eform-client/errorShots
- name: Pretest changes to work with Docker container
run: sed -i 's/localhost/mariadbtest/g' eform-angular-frontend/eform-client/e2e/Constants/DatabaseConfigurationConstants.ts
- name: Get standard output
run: |
cat docker_run_log
- name: DB Configuration
uses: cypress-io/github-action@v4
with:
start: echo 'hi'
wait-on: "http://localhost:4200"
wait-on-timeout: 120
browser: chrome
record: false
spec: cypress/e2e/db/*
config-file: cypress.config.ts
working-directory: eform-angular-frontend/eform-client
command-prefix: "--"
- name: Change rabbitmq hostname
run: docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
- name: Get standard output
run: |
cat docker_run_log
- name: Plugin testing
run: cd eform-angular-frontend/eform-client && npm run testheadlessplugin2${{matrix.test}}
- name: Load DB dump
if: matrix.test == 'a'
run: |
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 2'
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'drop database `420_SDK`'
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'create database `420_SDK`'
docker exec -i mariadbtest mysql -u root --password=secretpassword 420_SDK < eform-angular-frontend/eform-client/cypress/e2e/plugins/backend-configuration-pn/a/420_SDK.sql
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'drop database `420_eform-backend-configuration-plugin`'
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'create database `420_eform-backend-configuration-plugin`'
docker exec -i mariadbtest mysql -u root --password=secretpassword 420_eform-backend-configuration-plugin < eform-angular-frontend/eform-client/cypress/e2e/plugins/backend-configuration-pn/a/420_eform-backend-configuration-plugin.sql
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'drop database `420_eform-angular-items-planning-plugin`'
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'create database `420_eform-angular-items-planning-plugin`'
docker exec -i mariadbtest mysql -u root --password=secretpassword 420_eform-angular-items-planning-plugin < eform-angular-frontend/eform-client/cypress/e2e/plugins/backend-configuration-pn/a/420_eform-angular-items-planning-plugin.sql
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
- name: Restart the Docker container
if: matrix.test == 'a'
run: docker restart my-container
- name: Sleep 15
if: matrix.test == 'a'
run: sleep 15
- name: Get standard output
run: |
cat docker_run_log
result=`cat docker_run_log | grep "Now listening on: http://0.0.0.0:5000" -m 1 | wc -l`
if [ $result -ne 1 ];then exit 1; fi
- name: ${{matrix.test}} test
uses: cypress-io/github-action@v4
with:
start: echo 'hi'
wait-on: "http://localhost:4200"
wait-on-timeout: 120
browser: chrome
record: false
spec: cypress/e2e/plugins/backend-configuration-pn/${{matrix.test}}/*
config-file: cypress.config.ts
working-directory: eform-angular-frontend/eform-client
command-prefix: "--"
- name: Stop the newly build Docker container
run: docker stop my-container
- name: Get standard output
run: |
cat docker_run_log
result=`cat docker_run_log | grep "Now listening on: http://0.0.0.0:5000" -m 1 | wc -l`
if [ $result -ne 1 ];then exit 1; fi
- name: Archive screenshot artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: error Screenshots
path: |
eform-angular-frontend/eform-client/errorShots/chrome*.png
retention-days: 2
- name: Get standard output
if: ${{ failure() }}
run: |
cat docker_run_log
- name: Archive videos
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: error Screenshots
path: |
/home/runner/work/eform-backendconfiguration-plugin/eform-backendconfiguration-plugin/eform-angular-frontend/eform-client/cypress/videos/*.mp4
retention-days: 2
test-dotnet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create docker network
run: docker network create --driver bridge --attachable data
- name: Start MariaDB
run: |
docker pull mariadb:10.8
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:10.8
- name: Start rabbitmq
run: |
docker pull rabbitmq:latest
docker run -d --hostname my-rabbit --name some-rabbit --network data -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=password -p 5672:5672 rabbitmq:latest
- name: Sleep 15
run: sleep 15
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Build
run: dotnet build eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.sln
- name: Unit Tests
run: dotnet test --no-restore -c Release -v n eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Test/BackendConfiguration.Pn.Test.csproj
- name: Integration Tests
run: dotnet test --no-restore -c Release -v n eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Integration.Test/BackendConfiguration.Pn.Integration.Test.csproj