-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (179 loc) · 5.77 KB
/
dotnet.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
env:
DOTNET_ENVIRONMENT: CI
jobs:
build:
container: bitnami/dotnet-sdk:8.0.204
runs-on:
- ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Restore dotnet tools
run: cd InForm.Server && dotnet tool restore
- name: Generate migration bundle
run: cd InForm.Server && dotnet ef migrations bundle -o InForm.Migrations && tar czf ../InForm.Migrations.tgz InForm.Migrations appsettings.*.json
- name: Upload bundle artifact
uses: actions/upload-artifact@v4
with:
compression-level: 0
name: InForm.Migrations.tgz
overwrite: true
path: InForm.Migrations.tgz
load-tests:
container: bitnami/dotnet-sdk:8.0.204
needs:
- build
runs-on:
- ubuntu-latest
services:
test-db:
env:
POSTGRES_PASSWORD: postgres
image: postgres:16
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Download migrations bundle
uses: actions/download-artifact@v4
with:
name: InForm.Migrations.tgz
- name: Apply migrations bundle
run: tar xzf InForm.Migrations.tgz && ./InForm.Migrations
- name: Start InForm.Server
run: dotnet run -c Release -v m --project InForm.Server -lp ci &
- name: Install system packages
run: apt update && apt install -y python3.11 python3-pip
- name: Setup python packages
run: python3.11 -m pip install -r requirements.txt --break-system-packages
- name: Do load tests
run: locust --headless -f ci-utils/locustfile.py -H http://localhost:9000 -t 2m -u 3000 -r 100 --logfile locust.log --csv api
- name: Stop server
run: pkill -INT dotnet
- name: Parse load test results
run: python3.11 ci-utils/parse-locust.py api_stats.csv > load-stats.md
- if: always() && github.event_name == 'pull_request'
name: Comment statistics to PR
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: load-statistics-table
filePath: load-stats.md
- if: failure()
name: Upload locust logs to artifacts
uses: actions/upload-artifact@v4
with:
compression-level: 9
name: locust.log
overwrite: true
path: locust.log
packages-test:
container: bitnami/dotnet-sdk:8.0.204
runs-on:
- ubuntu-latest
steps:
- name: Install system packages
run: apt update && apt install -y jq python3.11
- name: Checkout
uses: actions/checkout@v4
- name: Restore
run: dotnet restore
- name: List vulnerable dependencies
run: sh ci-utils/list-pkg.sh vulnerable
- name: List outdated dependencies
run: sh ci-utils/list-pkg.sh outdated
- name: List deprecated dependencies
run: sh ci-utils/list-pkg.sh deprecated
- name: Fromat depdendency report
run: python3.11 ci-utils/parse-pkgs.py vulnerable.json outdated.json deprecated.json
- if: always() && github.event_name == 'pull_request'
name: Comment statistics to PR
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: dotnet-pkgs-report
filePath: dotnet-pkgs.md
tests:
container: bitnami/dotnet-sdk:8.0.204
needs:
- build
runs-on:
- ubuntu-latest
services:
test-db:
env:
POSTGRES_PASSWORD: postgres
image: postgres:16
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Download migrations bundle
uses: actions/download-artifact@v4
with:
name: InForm.Migrations.tgz
- name: Apply migrations bundle
run: tar xzf InForm.Migrations.tgz && ./InForm.Migrations
- name: Tests
run: dotnet test --no-build --verbosity normal
zap-test:
container: bitnami/dotnet-sdk:8.0.204
needs:
- build
runs-on:
- ubuntu-latest
services:
test-db:
env:
POSTGRES_PASSWORD: postgres
image: postgres:16
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Download migrations bundle
uses: actions/download-artifact@v4
with:
name: InForm.Migrations.tgz
- name: Apply migrations bundle
run: tar xzf InForm.Migrations.tgz && ./InForm.Migrations
- name: Start InForm.Server
run: dotnet run -c Release -v m --project InForm.Server -lp ci &
- name: Start InForm.Server
run: dotnet run -c Release -v m --project InForm.Web -lp ci &
- name: Install system packages
run: apt update && apt install -y openjdk-17-jdk curl firefox-esr chromium
- name: Install ZAP
run: 'curl -L https://github.com/zaproxy/zaproxy/releases/download/v2.14.0/ZAP_2.14.0_Linux.tar.gz | tar xz '
- name: ''
run: cd ZAP_2.14.0 && ./zap.sh -cmd -autorun ../ci-utils/zap.yaml
- name: Stop server
run: pkill -INT dotnet
- if: always() && github.event_name == 'pull_request'
name: Comment statistics to PR
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: zap-report
filePath: /root/zap-report.md
name: InForm CI
on:
pull_request:
branches:
- main
push:
branches:
- main