Skip to content

Commit 8d6f759

Browse files
committed
Fixing pr workflow.
1 parent 43ef282 commit 8d6f759

File tree

1 file changed

+164
-69
lines changed

1 file changed

+164
-69
lines changed
Lines changed: 164 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,189 @@
1-
name: .NET Pull requests
1+
name: .NET Master
22

33
on:
44
pull_request:
55
branches: [ master, stable, angular19 ]
6-
paths-ignore:
7-
- '**.md'
8-
- '.github/**'
96

107
jobs:
118
build:
129
runs-on: ubuntu-latest
1310
steps:
14-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1512
with:
16-
path: main
17-
- uses: getong/[email protected]
13+
path: eform-angular-basecustomer-plugin
14+
- name: 'Preparing Frontend checkout'
15+
uses: actions/checkout@v3
1816
with:
19-
host port: 3306 # Optional, default value is 3306. The port of host
20-
container port: 3306 # Optional, default value is 3306. The port of container
21-
character set server: 'utf8' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
22-
collation server: 'utf8_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
23-
mariadb version: '10.4.10' # Optional, default value is "latest". The version of the MariaDB
24-
mysql database: 'some_test' # Optional, default value is "test". The specified database which will be create
25-
mysql root password: 'secretpassword' # Required if "mysql user" is empty, default is empty. The root superuser password
26-
mysql user: 'developer' # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too
27-
mysql password: 'passwordtoo' # Required if "mysql user" exists. The password for the "mysql user"
28-
- name: Sleep 15 seconds
29-
run: sleep 15
30-
- uses: getong/[email protected]
17+
fetch-depth: 0
18+
repository: microting/eform-angular-frontend
19+
ref: stable
20+
path: eform-angular-frontend
21+
- name: Copy dependencies
22+
run: |
23+
cp -av eform-angular-basecustomer-plugin/eform-client/src/app/plugins/modules/customers-pn eform-angular-frontend/eform-client/src/app/plugins/modules/customers-pn
24+
cp -av eform-angular-basecustomer-plugin/eform-client/e2e/Tests/customer-settings eform-angular-frontend/eform-client/e2e/Tests/customer-settings
25+
cp -av eform-angular-basecustomer-plugin/eform-client/e2e/Tests/customer-general eform-angular-frontend/eform-client/e2e/Tests/customer-general
26+
cp -av eform-angular-basecustomer-plugin/eform-client/e2e/Page\ objects/Customers eform-angular-frontend/eform-client/e2e/Page\ objects/Customers
27+
cp -av eform-angular-basecustomer-plugin/eform-client/wdio-headless-plugin-step2a.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2a.conf.ts
28+
cp -av eform-angular-basecustomer-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts
29+
cd eform-angular-frontend/eform-client && ../../eform-angular-basecustomer-plugin/testinginstallpn.sh
30+
- name: Copy Dockerfile
31+
run: cp eform-angular-basecustomer-plugin/Dockerfile .
32+
- name: Build the tagged Docker image
33+
run: docker build . -t microtingas/customer-container:latest -t microtingas/customer-container:1.0.0 --build-arg GITVERSION=1.0.0 --build-arg PLUGINVERSION=1.0.0
34+
- name: Tag builds
35+
run: |-
36+
docker tag microtingas/customer-container:latest microtingas/customer-container:latest
37+
- run: docker save microtingas/customer-container:latest -o customer-container.tar
38+
- uses: actions/upload-artifact@v4
3139
with:
32-
rabbitmq version: '3.8.2-management-alpine'
33-
host port: 5672
34-
rabbitmq user: 'admin'
35-
rabbitmq password: 'password'
36-
rabbitmq vhost: 'vhost_name'
37-
- name: Setup .NET Core
38-
uses: actions/setup-dotnet@v1
40+
name: customer-container
41+
path: customer-container.tar
42+
pn-test:
43+
needs: build
44+
runs-on: ubuntu-22.04
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
test: [a,b,c,d,e,f,g]
49+
steps:
50+
- uses: actions/checkout@v3
3951
with:
40-
dotnet-version: 9.0.x
52+
path: eform-angular-basecustomer-plugin
53+
- uses: actions/download-artifact@v4
54+
with:
55+
name: customer-container
56+
- run: docker load -i customer-container.tar
57+
- name: Create docker network
58+
run: docker network create --driver bridge --attachable data
59+
- name: Start MariaDB
60+
run: |
61+
docker pull mariadb:10.8
62+
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:10.8
63+
- name: Start rabbitmq
64+
run: |
65+
docker pull rabbitmq:latest
66+
docker run -d --hostname my-rabbit --name some-rabbit --network data -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=password rabbitmq:latest
67+
- name: Sleep 15
68+
run: sleep 15
69+
- name: Start the newly build Docker container
70+
id: docker-run
71+
run: docker run --name my-container -p 4200:5000 --network data microtingas/customer-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 &
4172
- name: Use Node.js
42-
uses: actions/setup-node@v1
73+
uses: actions/setup-node@v3
4374
with:
44-
node-version: '12.16.2'
45-
- name: Extract branch name
46-
id: extract_branch
47-
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
75+
node-version: 20
4876
- name: 'Preparing Frontend checkout'
49-
uses: actions/checkout@v2
77+
uses: actions/checkout@v3
5078
with:
5179
repository: microting/eform-angular-frontend
52-
ref: ${{ github.event.pull_request.base.ref }}
80+
ref: stable
5381
path: eform-angular-frontend
54-
- name: Install dependencies
55-
run: dotnet restore main/eFormAPI/Plugins/Customers.Pn/Customers.Pn.sln
56-
- name: Get the version
57-
id: get_version
58-
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3 | cut -d "v" -f 2)
59-
- name: Build
60-
run: dotnet build main/eFormAPI/Plugins/Customers.Pn/Customers.Pn.sln
61-
- name: Unit Tests
62-
run: dotnet test --no-restore -c Release -v n main/eFormAPI/Plugins/Customers.Pn/Customers.Pn.Test/Customers.Pn.Test.csproj
6382
- name: Copy dependencies
6483
run: |
65-
cp -av main/eform-client/src/app/plugins/modules/customers-pn eform-angular-frontend/eform-client/src/app/plugins/modules/customers-pn
66-
cp -av main/eform-client/e2e/Tests/customer-settings eform-angular-frontend/eform-client/e2e/Tests/customer-settings
67-
cp -av main/eform-client/e2e/Tests/customer-general eform-angular-frontend/eform-client/e2e/Tests/customer-general
68-
cp -av main/eform-client/e2e/Assets/ eform-angular-frontend/eform-client/e2e/Assets
69-
cp -av main/eform-client/e2e/Page\ objects/Customers eform-angular-frontend/eform-client/e2e/Page\ objects/Customers
70-
cp -av main/eform-client/wdio-headless-plugin-step2.conf.js eform-angular-frontend/eform-client/wdio-headless-plugin-step2.conf.js
84+
cp -av eform-angular-basecustomer-plugin/eform-client/src/app/plugins/modules/customers-pn eform-angular-frontend/eform-client/src/app/plugins/modules/customers-pn
85+
cp -av eform-angular-basecustomer-plugin/eform-client/e2e/Tests/customer-settings eform-angular-frontend/eform-client/e2e/Tests/customer-settings
86+
cp -av eform-angular-basecustomer-plugin/eform-client/e2e/Tests/customer-general eform-angular-frontend/eform-client/e2e/Tests/customer-general
87+
cp -av eform-angular-basecustomer-plugin/eform-client/e2e/Page\ objects/Customers eform-angular-frontend/eform-client/e2e/Page\ objects/Customers
88+
cp -av eform-angular-basecustomer-plugin/eform-client/wdio-headless-plugin-step2a.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2a.conf.ts
89+
cp -av eform-angular-basecustomer-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts
7190
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
72-
cp -av main/eFormAPI/eFormAPI.Web/Plugins/Customers eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins/Customers
73-
cd eform-angular-frontend/eform-client && ../../main/testinginstallpn.sh
74-
- name: Build frontend
75-
run: dotnet build eform-angular-frontend/eFormAPI/eFormAPI.sln > dotnet_log 2>&1 &
76-
- name: NPM install
77-
run: cd eform-angular-frontend/eform-client && npm install
78-
- name: NPM start
79-
run: cd eform-angular-frontend/eform-client && npm start > npm_log 2>&1 &
80-
- name: Sleep 75 seconds
81-
run: sleep 75
82-
- name: Dotnet run
83-
run: dotnet run --project eform-angular-frontend/eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj > dotnet_log 2>&1 &
84-
- name: Sleep 75 seconds
85-
run: sleep 75
86-
- name: Configuration testing
87-
run: cd eform-angular-frontend/eform-client && npm run testheadless
88-
- name: Plugin testing
89-
run: cd eform-angular-frontend/eform-client && npm run testheadlessplugin
91+
mkdir -p eform-angular-frontend/eform-client/cypress/e2e/plugins/
92+
mkdir -p eform-angular-frontend/eform-client/cypress/fixtures/
93+
cp -av eform-angular-basecustomer-plugin/eform-client/cypress/fixtures eform-angular-frontend/eform-client/cypress
94+
cp -av eform-angular-basecustomer-plugin/eform-client/cypress/e2e/plugins/customers-pn eform-angular-frontend/eform-client/cypress/e2e/plugins/customers-pn
95+
cd eform-angular-frontend/eform-client && ../../eform-angular-basecustomer-plugin/testinginstallpn.sh
96+
- name: yarn install
97+
run: cd eform-angular-frontend/eform-client && yarn install
98+
- name: Create errorShots directory
99+
run: mkdir eform-angular-frontend/eform-client/errorShots
100+
- name: Pretest changes to work with Docker container
101+
run: sed -i 's/localhost/mariadbtest/g' eform-angular-frontend/eform-client/e2e/Constants/DatabaseConfigurationConstants.ts
102+
- name: Get standard output
103+
run: |
104+
cat docker_run_log
105+
- name: DB Configuration
106+
uses: cypress-io/github-action@v4
107+
with:
108+
start: echo 'hi'
109+
wait-on: "http://localhost:4200"
110+
wait-on-timeout: 120
111+
browser: chrome
112+
record: false
113+
spec: cypress/e2e/db/*
114+
config-file: cypress.config.ts
115+
working-directory: eform-angular-frontend/eform-client
116+
command-prefix: "--"
117+
- name: Change rabbitmq hostname
118+
run: docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
119+
- name: Create database
120+
if: matrix.test == 'd'
121+
run: |
122+
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 1'
123+
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'create database `420_eform-angular-customer-plugin`'
124+
docker exec -i mariadbtest mariadb -u root --password=secretpassword 420_SDK < eform-angular-frontend/eform-client/cypress/e2e/plugins/customers-pn/d/420_SDK.sql
125+
docker exec -i mariadbtest mariadb -u root --password=secretpassword 420_eform-angular-customer-plugin < eform-angular-frontend/eform-client/cypress/e2e/plugins/customers-pn/d/420_eform-angular-customer-plugin.sql
126+
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
127+
- name: Create database
128+
if: matrix.test != 'd'
129+
run: |
130+
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 1'
131+
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'create database `420_eform-angular-customer-plugin`'
132+
docker exec -i mariadbtest mariadb -u root --password=secretpassword 420_SDK < eform-angular-frontend/eform-client/cypress/e2e/plugins/customers-pn/a/420_SDK.sql
133+
docker exec -i mariadbtest mariadb -u root --password=secretpassword 420_eform-angular-customer-plugin < eform-angular-frontend/eform-client/cypress/e2e/plugins/customers-pn/a/420_eform-angular-customer-plugin.sql
134+
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
135+
- name: ${{matrix.test}} test
136+
uses: cypress-io/github-action@v4
137+
with:
138+
start: echo 'hi'
139+
wait-on: "http://localhost:4200"
140+
wait-on-timeout: 120
141+
browser: chrome
142+
record: false
143+
spec: cypress/e2e/plugins/customers-pn/${{matrix.test}}/*
144+
config-file: cypress.config.ts
145+
working-directory: eform-angular-frontend/eform-client
146+
command-prefix: "--"
147+
- name: Stop the newly build Docker container
148+
run: docker stop my-container
149+
- name: Get standard output
150+
run: |
151+
cat docker_run_log
152+
result=`cat docker_run_log | grep "Now listening on: http://0.0.0.0:5000" -m 1 | wc -l`
153+
if [ $result -ne 1 ];then exit 1; fi
90154
- name: The job has failed
155+
if: always()
156+
run: |
157+
cat docker_run_log
158+
- name: Archive screenshot artifacts
91159
if: ${{ failure() }}
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: error Screenshots
163+
path: |
164+
eform-angular-frontend/eform-client/errorShots/chrome*.png
165+
retention-days: 2
166+
test-dotnet:
167+
runs-on: ubuntu-latest
168+
steps:
169+
- uses: actions/checkout@v3
170+
- name: Create docker network
171+
run: docker network create --driver bridge --attachable data
172+
- name: Start MariaDB
173+
run: |
174+
docker pull mariadb:10.8
175+
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:10.8
176+
- name: Start rabbitmq
92177
run: |
93-
cat dotnet_log
94-
cat eform-angular-frontend/eform-client/npm_log
178+
docker pull rabbitmq:latest
179+
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
180+
- name: Sleep 15
181+
run: sleep 15
182+
- name: Setup .NET Core
183+
uses: actions/setup-dotnet@v3
184+
with:
185+
dotnet-version: 9.0.x
186+
- name: Build
187+
run: dotnet build eFormAPI/Plugins/Customers.Pn/Customers.Pn.sln
188+
- name: Unit Tests
189+
run: dotnet test --no-restore -c Release -v n eFormAPI/Plugins/Customers.Pn/Customers.Pn.Test/Customers.Pn.Test.csproj

0 commit comments

Comments
 (0)