-
Notifications
You must be signed in to change notification settings - Fork 16
144 lines (139 loc) · 5.23 KB
/
performance.yaml
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
name: Performance Test K8s-snap
on:
push:
branches: ["master"]
pull_request:
permissions:
pull-requests: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BASE_SHA: ${{ github.before || github.event.pull_request.base.sha }}
BASE_BRANCH: ${{ github.base_ref || github.ref }}
TARGET_SHA: ${{ github.sha }}
jobs:
build:
name: K8s-snap Performance Test
runs-on: self-hosted-linux-amd64-jammy-large
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Checking out repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: |
pip install tox
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Set-up R
run: |
sudo apt-get install -y r-base
sudo Rscript -e 'install.packages(c("ggplot2", "dplyr", "optparse"), repos="https://cloud.r-project.org")'
- name: Install lxd
uses: canonical/k8s-snap/.github/actions/install-lxd@main
- name: Download latest k8s-snap
run: |
sudo snap download k8s --channel=latest/edge --basename k8s
- name: Unpack Snap
run: |
sudo unsquashfs -d snap-unpack-dir k8s.snap
- name: Create snap with k8s-dqlite ${{ github.head_ref }} code
run: |
make static
sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite
sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite
sudo mksquashfs snap-unpack-dir head.snap -noappend -comp lzo -no-fragments
- name: Create snap with k8s-dqlite base-code
run: |
set -o pipefail
git fetch origin $BASE_BRANCH
git reset --hard $BASE_SHA
make static
sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite
sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite
sudo mksquashfs snap-unpack-dir base-code.snap -noappend -comp lzo -no-fragments
- name: Switch back to target branch
run: git reset --hard $TARGET_SHA
- name: Run Performance test ${{ github.head_ref }} snap
env:
TEST_SNAP: ${{ github.workspace }}/head.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ubuntu:22.04
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
TEST_METRICS_DIR: ${{ github.workspace }}/test/performance/results/head
TEST_RUN_NAME: head
TEST_DQLITE_TRACE_LEVEL: 1
TEST_RAFT_TRACE_LEVEL: 1
TEST_K8S_DQLITE_DEBUG: 1
run: |
cd test/performance
mkdir -p ./results/head
set -ex
iteration=0
while [[ $iteration -lt 10 ]]; do
echo "iteration: $iteration"
sg lxd -c 'tox -e performance'
iteration=$(( $iteration + 1 ))
done
- name: Run Performance test for base code snap
env:
TEST_SNAP: ${{ github.workspace }}/base-code.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ubuntu:22.04
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
TEST_METRICS_DIR: ${{ github.workspace }}/test/performance/results/base-code
TEST_RUN_NAME: base-code
TEST_DQLITE_TRACE_LEVEL: 1
TEST_RAFT_TRACE_LEVEL: 1
TEST_K8S_DQLITE_DEBUG: 1
run: |
cd test/performance
mkdir -p ./results/base-code
set -ex
iteration=0
while [[ $iteration -lt 10 ]]; do
echo "iteration: $iteration"
sg lxd -c 'tox -e performance'
iteration=$(( $iteration + 1 ))
done
- name: Generate 3 node Graphs
if: always()
run: |
cd test/performance
sudo Rscript parse-performance-metrics.R -p ./results/head -o ./results/head -f *three-node.log
sudo Rscript parse-performance-metrics.R -p ./results/base-code -o ./results/base-code -f *three-node.log
- name: Generate single node Graphs
if: always()
run: |
cd test/performance
mkdir -p ./results/single-node
cp ./results/head/*single-node.log ./results/single-node
cp ./results/base-code/*single-node.log ./results/single-node
sudo Rscript parse-performance-metrics.R -p ./results/single-node -o ./results/single-node -f *single-node.log
- name: Upload performance result
uses: actions/upload-artifact@v4
if: always()
with:
name: performance-results
path: ${{ github.workspace }}/test/performance/results
- name: Prepare inspection reports
if: failure()
run: |
tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports
echo "artifact_name=inspection-reports" | sed 's/:/-/g' >> $GITHUB_ENV
- name: Upload inspection report artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: ${{ github.workspace }}/inspection-reports.tar.gz