forked from microting/eform-angular-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (137 loc) · 5.18 KB
/
dotnet-core-pr.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
name: Pull requests
on:
pull_request:
branches: [ master, stable ]
paths-ignore:
- '*.md'
- '.github/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache node_modules
id: cache
uses: actions/cache@v3
with:
path: eform-client/node_modules
key: ${{ runner.os }}-build-${{ hashFiles('eform-client/package.json') }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.12.1'
- name: NPM Install
run: cd eform-client && npm install
if: steps.cache.outputs.cache-hit != 'true'
- name: Build Docker image
id: build
run: docker build . -t microtingas/frontend-container:latest --build-arg GITVERSION=1.0.0
shell: bash
- run: docker save microtingas/frontend-container:latest -o container.tar
- uses: actions/upload-artifact@v3
with:
name: container
path: container.tar
test:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test: [a,b,c,d,e,f,g,h,i,j]
steps:
- uses: actions/checkout@v3
- name: Cache node_modules
id: cache
uses: actions/cache@v3
with:
path: eform-client/node_modules
key: ${{ runner.os }}-build-${{ hashFiles('eform-client/package.json') }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/download-artifact@v3
with:
name: container
- run: docker load -i container.tar
- name: Create docker network 🖧
run: docker network create --driver bridge data
- name: Start MariaDB
run: |
docker pull mariadb:latest
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306 -d mariadb:latest
- 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: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.12.1'
- name: NPM Install
run: cd eform-client && npm install
if: steps.cache.outputs.cache-hit != 'true'
- name: Create errorShots directory
run: mkdir /home/runner/work/eform-angular-frontend/eform-angular-frontend/eform-client/errorShots
- name: Start the newly build Docker container
id: docker-run
run: docker run --name my-container -p 4200:5000 --network data microtingas/frontend-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: Sleep 15 seconds
run: sleep 15
- name: Get standard output
run: cat docker_run_log
- name: Pretest changes to work with Docker container
run: sed -i 's/localhost/mariadbtest/g' eform-client/e2e/Constants/DatabaseConfigurationConstants.ts
- name: Configuration testing
run: cd eform-client && npm run testheadless
- name: testheadless2${{matrix.test}}
run: cd eform-client && npm run testheadless2${{matrix.test}}
- 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: The job has failed
if: ${{ failure() }}
run: |
cat docker_run_log
- name: Archive screenshot artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: error Screenshots
path: |
/home/runner/work/eform-angular-frontend/eform-angular-frontend/eform-client/errorShots/errorShots/chrome*.png
retention-days: 2
test-dotnet:
needs: build
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:latest
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:latest
- 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: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Install dependencies
run: dotnet restore eFormAPI/eFormAPI.sln
- name: Build
run: dotnet build eFormAPI/eFormAPI.sln
- name: Unit Tests
run: dotnet test --no-restore -c Release -v n eFormAPI/eFormAPI.Web.Tests/eFormAPI.Web.Tests.csproj
- name: Integration Tests
run: dotnet test --no-restore -c Release -v n eFormAPI/eFormAPI.Web.Integration.Tests/eFormAPI.Web.Integration.Tests.csproj