-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (44 loc) · 2.26 KB
/
benchmark.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
name: Benchmark
on: [push, pull_request]
jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2 # we should only need current + parent commits
- name: Set up Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.18
id: go
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.BENCHMARKS_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.BENCHMARKS_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Run benchmarks
run: go test ./... -bench=. | tee bench-$GITHUB_SHA.txt
- name: Run parent benchmarks
run: git checkout HEAD^ && go test ./... -bench=. | tee bench-$(git rev-parse $GITHUB_SHA^).txt && ls -larth .
- name: Convert benchmarks into json
run: ruby .github/workflows/convert_benchmarks_to_json.rb bench-$GITHUB_SHA.txt > bench-$GITHUB_SHA.json
- name: Convert parent benchmarks into json
run: ruby .github/workflows/convert_benchmarks_to_json.rb bench-$(git rev-parse $GITHUB_SHA^).txt > bench-$(git rev-parse $GITHUB_SHA^).json
- name: Upload bench to s3
run: aws s3 cp bench-$GITHUB_SHA.json s3://raytracer-go-benchmarks/bench-$GITHUB_SHA.json --region us-east-1
- name: Upload parent bench to s3
run: aws s3 cp bench-$(git rev-parse $GITHUB_SHA^).json s3://raytracer-go-benchmarks/bench-$(git rev-parse $GITHUB_SHA^).json --region us-east-1
# - name: Get parent bench from s3
# run: aws s3 cp s3://raytracer-go-benchmarks/bench-$(git rev-parse $GITHUB_SHA^).json .
- name: Compare benches
run: ruby .github/workflows/compare_benchmarks.rb $GITHUB_SHA $(git rev-parse $GITHUB_SHA^) | tee bench-comparison-$(git rev-parse $GITHUB_SHA^)-$GITHUB_SHA.txt
- name: Upload bench comparison to s3
run: aws s3 cp bench-comparison-$(git rev-parse $GITHUB_SHA^)-$GITHUB_SHA.txt s3://raytracer-go-benchmarks/bench-comparison-$(git rev-parse $GITHUB_SHA^)-$GITHUB_SHA.txt --region us-east-1
- name: List files
run: ls -lart