Skip to content

Commit

Permalink
added workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AKorpusenko committed Feb 28, 2024
1 parent f951faa commit 3b6366f
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 169 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/degradation-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Degradation test

on:
push:
branches:
- "**"

jobs:
align:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20.x"

- name: Tidy up dependencies
run: go mod tidy

- name: Install yq
run: sudo snap install yq

- name: Build degradation tester tool
run: |
cd ./scripts/degradation-tester
go install .
- name: Run performance tests
run: |
make degradation-tester
env:
GO111MODULE: on
43 changes: 0 additions & 43 deletions scripts/degradation-tester/benchmarks/types_benchstat.txt

This file was deleted.

86 changes: 0 additions & 86 deletions scripts/degradation-tester/benchmarks/types_results_new.txt

This file was deleted.

15 changes: 0 additions & 15 deletions scripts/degradation-tester/benchmarks/validation_benchstat.txt

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/degradation-tester/benchmarks/validation_results_new.txt

This file was deleted.

10 changes: 5 additions & 5 deletions scripts/degradation-tester/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ Tests:
- PackagePath: "./protocol/v2/types"
TestCases:
- Name: "VerifyBLS"
AllowedDeltaPercentage: 3.0
AllowedDeltaPercentage: 6.0
- Name: "VerifyPKCS1v15"
AllowedDeltaPercentage: 3.0
- Name: "VerifyPKCS1v15FastHash"
AllowedDeltaPercentage: 3.0
AllowedDeltaPercentage: 6.0
- Name: "VerifyPSS"
AllowedDeltaPercentage: 3.0
AllowedDeltaPercentage: 6.0
- Name: "SignBLS"
AllowedDeltaPercentage: 3.0
AllowedDeltaPercentage: 6.0
- Name: "SignPKCS1v15"
AllowedDeltaPercentage: 3.0
AllowedDeltaPercentage: 6.0
- Name: "SignPKCS1v15FastHash"
AllowedDeltaPercentage: 3.0
- Name: "SignPSS"
Expand Down
10 changes: 7 additions & 3 deletions scripts/degradation-tester/degradation-check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash


prefix="./scripts/degradation-tester"
configFile="$prefix/config.yaml"
benchmarksResults="$prefix/benchmarks"
Expand All @@ -10,17 +11,20 @@ for pkgPath in "${packagePaths[@]}"; do
packageName=$(basename "$pkgPath")
outputFile="${benchmarksResults}/${packageName}_results_new.txt"
oldBenchmarks="${benchmarksResults}/${packageName}_results_old.txt"
benchStatFile="${benchmarksResults}/${packageName}_benchstat.txt"

# echo "Benchmarking package $packageName..."
go test -bench=. -count=10 -benchmem "$pkgPath" | tee "$outputFile"

benchStatFile="${benchmarksResults}/${packageName}_benchstat.txt"
benchstat "$oldBenchmarks" "$outputFile" &> "${benchStatFile}"

"${prefix}/degradation-tester" "${configFile}" "${benchStatFile}"
degradation-tester "${configFile}" "${benchStatFile}"
if [ $? -ne 0 ]; then
echo "❌ Degradation tests have failed for ${packageName} package."
exit 1
fi

echo "✅ Degradation tests have passed for ${packageName} package."

rm "${benchStatFile}"
rm "${outputFile}"
done
Binary file modified scripts/degradation-tester/degradation-tester
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/degradation-tester/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var config Config

func main() {
if len(os.Args) < 3 {
fmt.Println("Usage: go run script.go <config_filename> <results_filename>")
fmt.Println("Usage: degradation-tester <config_filename> <results_filename>")
os.Exit(1)
}

Expand Down

0 comments on commit 3b6366f

Please sign in to comment.