forked from virtuallynathan/qpep
-
Notifications
You must be signed in to change notification settings - Fork 2
204 lines (177 loc) · 6.26 KB
/
build-performance.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
name: Performance Common (Build)
on:
workflow_call:
jobs:
build-client:
runs-on: vm-client
env:
GO_VERSION: 1.20.14
CMAKE_VERSION: '3.22.x'
GH_TOKEN: ${{ github.token }}
CACHE_KEY: qpep_client-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
CMAKE_BUILD_PARALLEL_LEVEL: 8
steps:
- name: Install the github cli
uses: sersoft-gmbh/setup-gh-cli-action@v2
with:
version:
stable
- name: Restore cached build
id: cache-build
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/build
key: ${{ env.CACHE_KEY }}
- name: Cleanup previous cached build
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
continue-on-error: true
shell: pwsh
run: |
$ARTID = @(gh cache list --repo project-faster/qpep --json id,key -q '.[]|select(.key | startswith("qpep_client-"))|.id' )
write-host "removing cache # $ARTID"
gh cache delete --repo project-faster/qpep $ARTID
- name: Cleanup workspace
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
shell: pwsh
run: |
rm ${{ github.workspace }}\* -r -force
- uses: actions/checkout@v4
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
with:
clean: true
submodules: true
- name: Set up Go
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up CMake
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
uses: jwlawson/[email protected]
with:
cmake-version: ${{ env.CMAKE_VERSION }}
- name: Prepare
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
shell: pwsh
run: |
New-Item -Path . -Name "build" -ItemType "directory" -Force | Out-Null
New-Item -Path . -Name "build/config" -ItemType "directory" -Force | Out-Null
Copy-Item "./docker/client-env/*.pem" "./build"
Copy-Item "./windivert/x64/*" -Destination "./build"
- name: Build Client (Backends)
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
shell: cmd
run: |
set CGO_ENABLED=1
set GOOS=windows
set GOHOSTARCH=amd64
set GOHOSTOS=windows
cd backend/
go generate
- name: Build Client
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
shell: cmd
run: |
set CGO_ENABLED=1
set GOOS=windows
set GOHOSTARCH=amd64
set GOHOSTOS=windows
go build -v -o build/qpep.exe
- name: Cache build
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/build
key: ${{ env.CACHE_KEY }}
- name: Auto-cancel workflow on error
if: failure()
uses: andymckay/[email protected]
build-server:
runs-on: vm-server
env:
GO_VERSION: 1.20.14
CMAKE_VERSION: '3.22.x'
GH_TOKEN: ${{ github.token }}
CACHE_KEY: qpep_server-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
CMAKE_BUILD_PARALLEL_LEVEL: 8
steps:
- name: Pre-Cleanup
run: |
# stop docker randomly disrupting container network
sudo systemctl restart docker || true
# cleanup previous results if any
sudo rm -rf build/* || true
sudo rm -rf docker/server-data-env/output/* || true
- name: Install the github cli
uses: sersoft-gmbh/setup-gh-cli-action@v2
with:
version:
stable
- name: Restore cached build
id: cache-build
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/build
key: ${{ env.CACHE_KEY }}
- name: Cleanup previous cached build
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
continue-on-error: true
run: |
ARTID=$(gh cache list --repo project-faster/qpep --json id,key -q '.[]|select(.key | startswith("qpep_server-"))|.id' )
echo "removing cache # $ARTID"
gh cache delete --repo project-faster/qpep "$ARTID"
- uses: actions/checkout@v4
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
with:
clean: true
submodules: true
- name: Set up Go
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up CMake
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
uses: jwlawson/[email protected]
with:
cmake-version: ${{ env.CMAKE_VERSION }}
- name: Build server (Init submodules)
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
run: |
git submodule init
git submodule update
- name: Build server (Backends)
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
run: |
cd backend
go env
go generate
- name: Build server
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
run: |
mkdir -p build
mkdir -p build/config
go build -v -o build/qpep
rm -rf backends/quicly-go/gen_*
cp ./docker/server-env/server/*.pem ./build
- name: Cache build
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/build
key: ${{ env.CACHE_KEY }}
- name: Cleanup all docker
run: |
docker version
PERC=$(df -l -h / | tail -n1 | cut -d ' ' --fields=16 | sed -s 's/%//')
if [[ $PERC -gt 90 ]]; then
echo "Pruning cached docker data"
docker system prune -af || true
fi
- name: Build Data Server
run: |
cd docker/server-data-env/
docker compose build
- name: Auto-cancel workflow on error
if: failure()
uses: andymckay/[email protected]