forked from Tongsuo-Project/Tongsuo
-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (171 loc) · 6.5 KB
/
speed-test.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
name: Speed Test
on:
push:
branches:
- 'master'
schedule:
- cron: '0 0 * * *'
jobs:
test:
if: ${{ github.event.pull_request.merged || github.event.schedule == '0 0 * * *' }}
runs-on: [self-hosted,X64]
env:
MYSQL_ARG: "--mysql-host=${{ secrets.MYSQL_HOST }} --mysql-user=${{ secrets.MYSQL_USER }} --mysql-password=${{ secrets.MYSQL_PASSWORD }} --mysql-db=${{ secrets.MYSQL_DB }}"
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: fetch all branch
uses: nick-fields/retry@v2
with:
timeout_seconds: 30
max_attempts: 60
shell: bash
command: git fetch --depth=1
- name: config
run: ./config --strict-warnings enable-ec_elgamal enable-paillier enable-zuc enable-ntls enable-sm2 enable-sm3 enable-sm4 enable-fips --api=1.1.1 && perl configdata.pm --dump
- name: make
run: make -j4
- name: Set current date as env variable
run: |
NOW=$(date +'%F~%T')
echo "NOW=$NOW" >> $GITHUB_ENV
echo "JOB_DATE='$NOW'" | sed 's/~/ /g' >> $GITHUB_ENV
- name: save cpu and memory info
shell: bash
run: |
mkdir -p speed/cpu
mkdir -p speed/mem
lscpu > speed/cpu/$NOW.txt
CPUS=`cat /sys/fs/cgroup/cpuset/cpuset.cpus`
CPUQ=`cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us`
CPUP=`cat /sys/fs/cgroup/cpu/cpu.cfs_period_us`
echo "/sys/fs/cgroup/cpuset/cpuset.cpus: $CPUS" >> speed/cpu/$NOW.txt
echo "/sys/fs/cgroup/cpu/cpu.cfs_quota_us: $CPUQ" >> speed/cpu/$NOW.txt
echo "/sys/fs/cgroup/cpu/cpu.cfs_period_us: $CPUP" >> speed/cpu/$NOW.txt
free -mh > speed/mem/$NOW.txt
MEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes`
echo "/sys/fs/cgroup/memory/memory.limit_in_bytes: $MEM" >> speed/mem/$NOW.txt
- name: symmetric encryption speed test
shell: bash
run: |
set -x
commit=`git rev-parse HEAD`
algo_type="symmetric_encryption"
algos=(aes-256-gcm aes-256-ccm aes-256-cbc aes-128-gcm aes-128-ccm aes-128-cbc sm4-gcm sm4-ccm sm4-cbc zuc-128-eea3)
for algo in ${algos[@]}
do
mkdir -p speed/$algo_type/$algo
now=`date +"%F %T"`
FILE="./speed/$algo_type/$algo/$NOW.txt"
echo "commit: $commit" >> $FILE
echo "date: $now" >> $FILE
LD_LIBRARY_PATH=. ./apps/openssl speed -evp $algo | tee -a $FILE
done
echo $MYSQL_ARG > /tmp/mysql_arg.txt
- name: asymmetric encryption speed test
shell: bash
run: |
echo "TODO"
- name: signature speed test
shell: bash
run: |
commit=`git rev-parse HEAD`
algo_type="signature"
algos=(rsa2048 ecdsap256 ed25519 sm2)
for algo in ${algos[@]}
do
mkdir -p speed/$algo_type/$algo
now=`date +"%F %T"`
FILE="./speed/$algo_type/$algo/$NOW.txt"
echo "commit: $commit" >> $FILE
echo "date: $now" >> $FILE
LD_LIBRARY_PATH=. ./apps/openssl speed $algo | tee -a $FILE
done
- name: digest speed test
shell: bash
run: |
commit=`git rev-parse HEAD`
algo_type="digest"
algos=(sha256 sm3 zuc-128-eia3)
for algo in ${algos[@]}
do
mkdir -p speed/$algo_type/$algo
now=`date +"%F %T"`
FILE="./speed/$algo_type/$algo/$NOW.txt"
echo "commit: $commit" >> $FILE
echo "date: $now" >> $FILE
LD_LIBRARY_PATH=. ./apps/openssl speed $algo | tee -a $FILE
done
- name: key_exchange speed test
shell: bash
run: |
commit=`git rev-parse HEAD`
algo_type="key_exchange"
algos=(ecdhp256 ecdhp384 ecdhp521 ecdhx448 ecdhx25519)
for algo in ${algos[@]}
do
mkdir -p speed/$algo_type/$algo
now=`date +"%F %T"`
FILE="./speed/$algo_type/$algo/$NOW.txt"
echo "commit: $commit" >> $FILE
echo "date: $now" >> $FILE
LD_LIBRARY_PATH=. ./apps/openssl speed $algo | tee -a $FILE
done
- name: phe speed test
shell: bash
run: |
commit=`git rev-parse HEAD`
algo_type="phe"
algos=(ecelgamalp256 ecelgamalsm2 paillier)
for algo in ${algos[@]}
do
mkdir -p speed/$algo_type/$algo
now=`date +"%F %T"`
FILE="./speed/$algo_type/$algo/$NOW.txt"
echo "commit: $commit" >> $FILE
echo "date: $now" >> $FILE
LD_LIBRARY_PATH=. ./apps/openssl speed $algo | tee -a $FILE
done
- name: switch to the speed-auto-test branch and commit speed test result file
run: |
make clean
git checkout speed-auto-test
git add ./speed/*
git -c user.name="github-actions[bot]" \
-c user.email="github-actions[bot]@users.noreply.github.com" \
commit -a -m "Benchmark automated testing." \
--author="${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
- name: push speed test result
uses: nick-fields/retry@v2
with:
timeout_seconds: 30
max_attempts: 60
shell: bash
command: git push -u origin speed-auto-test:speed-auto-test
- name: Parse the test results file and save it to the mysql database
shell: bash
run: |
commit=`git rev-parse HEAD`
algos=(
'symmetric_encryption aes-256-gcm aes-256-ccm aes-256-cbc aes-128-gcm aes-128-ccm aes-128-cbc sm4-gcm sm4-ccm sm4-cbc'
'signature rsa2048 ecdsap256 ed25519 sm2'
'digest sha256 sm3'
'key_exchange ecdhp256 ecdhp384 ecdhp521 ecdhx448 ecdhx25519'
'phe ecelgamalp256 ecelgamalsm2 paillier'
)
for item in "${algos[@]}"; do
algo_type=''
for algo in ${item[@]}; do
if [[ $algo_type == '' ]]; then
algo_type=$algo
continue
fi
FILE="./speed/$algo_type/$algo/$NOW.txt"
python3 /home/runner/speed_parse.py -c $commit -f $FILE -t $algo_type -j "$JOB_DATE" $MYSQL_ARG
done
done
- name: check dirty
run: |
git checkout master
test $(git status --porcelain | wc -l) -eq "0"