This repository was archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (184 loc) · 6.61 KB
/
benchmark-and-deploy.yaml
File metadata and controls
185 lines (184 loc) · 6.61 KB
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
run-name: Benchmark & Deploy / ${{ github.event.head_commit.message }}
name: Benchmark & Deploy
on:
workflow_dispatch:
push:
pull_request:
types: [opened]
pull_request_target:
branches:
- "*"
jobs:
cppcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install CppCheck
run: |
sudo -H apt-get update -y
sudo -H apt-get install cppcheck
- name: Run Cppcheck
run: cppcheck --std=c++20 -I./lib --xml --xml-version=2 --force --enable=all example lib/core 2> cppcheck_res.xml
- name: Generate Report
run: cppcheck-htmlreport --title=WebFrame --file=cppcheck_res.xml --report-dir=codeql_report
- name: Upload Report
uses: actions/upload-artifact@v1
with:
name: cppcheck
path: codeql_report
doxygen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Configure
shell: bash
run: |
sudo apt install doxygen
doxygen Doxyfile
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: doxygen
path: |
reports/docs
benchmarks:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
port: [8888]
server: [ac++-O, ac++-O1, ac++-O2, ac++-O3, ac++-Ofast, ac++-Og, ac++-Os, c++-O, c++-O1, c++-O2, c++-O3, c++-Ofast, c++-Og, c++-Os, python, node]
name: ${{ matrix.os }}-${{ matrix.server }}
runs-on: ${{ matrix.os }}
steps:
- id: env
name: Get optimization
if: startsWith(matrix.server, 'c++') || startsWith(matrix.server, 'ac++')
shell: bash
run: |
declare -x optimization="`echo ${{ matrix.server }} | cut -d'-' -f2`"
[[ "$optimization" = "" ]] && optimization="default" || optimization="-$optimization"
echo "optimization=$optimization" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install dependencies on ubuntu
if: startsWith(matrix.server, 'c++') || startsWith(matrix.server, 'ac++')
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-11 g++-11 cmake
cmake --version
gcc-11 --version
g++-11 --version
- name: Install WebFrame & Build servers 🔧
shell: bash
run: |
CXX_COMPILER=g++-11 cmake -DOPTIMIZATION=${{ steps.env.outputs.optimization }} . && make
- name: Run Atomic server 🔧
if: startsWith(matrix.server, 'ac++')
shell: bash
run: |
./BenchmarkAtomic ${{ matrix.port }} &
- name: Run Normal server 🔧
if: startsWith(matrix.server, 'c++')
shell: bash
run: |
./BenchmarkNormal ${{ matrix.port }} &
- name: Install Flask & Run 🔧
if: startsWith(matrix.server, 'python')
shell: bash
run: |
python -m pip install flask;
python benchmark/contestants/server.py &
- name: Install Express & Run 🔧
if: startsWith(matrix.server, 'node')
shell: bash
run: |
npm install express;
node benchmark/contestants/server.js &
- name: Run benchmark 🚀
shell: bash
run: |
cd benchmark;
mkdir tmp;
bash benchmarker.sh 8888 ${{ matrix.server }};
- name: Upload Report 🚀
uses: actions/upload-artifact@v1
with:
name: benchmark_${{ matrix.server }}-${{ steps.env.outputs.optimization }}
path: benchmark/tmp/
benchmark:
needs: [benchmarks]
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Download all artifacts 🔧
uses: actions/download-artifact@v3
- name: Prepare
shell: bash
run: |
mkdir -p benchmark/report/;
paste -d "," benchmark_*/test1.curl.csv > benchmark/report/test1.curl.csv;
paste -d "," benchmark_*/test1.time.csv > benchmark/report/test1.time.csv;
paste -d "," benchmark_*/test2.curl.csv > benchmark/report/test2.curl.csv;
paste -d "," benchmark_*/test2.time.csv > benchmark/report/test2.time.csv;
cd benchmark;
chmod +x ./csv2html.sh;
./csv2html.sh report/test1.curl.csv "Test 1 / CURL total time" > report/test1.curl.html
./csv2html.sh report/test1.time.csv "Test 1 / CURL time %e" > report/test1.time.html
./csv2html.sh report/test2.curl.csv "Test 2 / CURL total time" > report/test2.curl.html
./csv2html.sh report/test2.time.csv "Test 2 / CURL time %e" > report/test2.time.html
cat report/*.*.html > report/index.html
- name: Upload Report 🚀
uses: actions/upload-artifact@v1
with:
name: benchmark_report
path: benchmark/report/
deploy:
runs-on: ubuntu-latest
needs: [cppcheck, doxygen, benchmark]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Download all artifacts 🔧
uses: actions/download-artifact@v3
- name: Prepare
shell: bash
run: |
rm -rf ./reports
mkdir -p ./reports/benchmark ./reports/docs ./reports/codeql_report
mv -f ./cppcheck/* reports/codeql_report/
mv -f ./doxygen/* reports/docs/
mv -f ./benchmark_report/* ./reports/benchmark/
- name: Commit the reports
shell: bash
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add reports/
git commit -m "Pipeline reports"
- name: Push pipeline reports
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Deploy to GitHub Pages 🚀
continue-on-error: true
if: ${{ always() && github.ref == 'refs/heads/master' }}
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./reports # The folder the action should deploy.