Skip to content

Commit

Permalink
Merge pull request #26 from k1LoW/benchmarck-same-runner
Browse files Browse the repository at this point in the history
Run 2 benchmarks on same runner
  • Loading branch information
k1LoW authored Oct 4, 2023
2 parents 0603042 + 26333df commit d6c18d5
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 6 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: benchmark

on:
pull_request:

jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Check out source code (main)
uses: actions/checkout@v4
with:
ref: main
path: main

- name: Set up deps
run: make depsdev

- name: Run benchmark (main)
run: make benchmark
working-directory: main

- name: Run octocov (main)
uses: k1LoW/octocov-action@v0
with:
config: .octocov.benchmark.main.yml
env:
OCTOCOV_GITHUB_REF: refs/heads/main
OCTOCOV_GITHUB_SHA: none
OCTOCOV_CUSTOM_METRICS_BENCHMARK: main/custom_metrics_benchmark.json

- name: Run benchmark
run: make benchmark

- name: Run octocov
uses: k1LoW/octocov-action@v0
with:
config: .octocov.benchmark.yml
env:
OCTOCOV_CUSTOM_METRICS_BENCHMARK: custom_metrics_benchmark.json
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,5 @@ jobs:
- name: Run tests
run: make ci

- name: Run benchmark
run: make benchmark

- name: Run octocov
uses: k1LoW/octocov-action@v0
env:
OCTOCOV_CUSTOM_METRICS_BENCHMARK: custom_metrics_benchmark.json
10 changes: 10 additions & 0 deletions .octocov.benchmark.main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repository: ${GITHUB_REPOSITORY}/benchmark
coverage:
if: false
codeToTestRatio:
if: false
testExecutionTime:
if: false
report:
datastores:
- local://main
14 changes: 14 additions & 0 deletions .octocov.benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repository: ${GITHUB_REPOSITORY}/benchmark
coverage:
if: false
codeToTestRatio:
if: false
testExecutionTime:
if: false
diff:
datastores:
- local://main
comment:
if: is_pull_request
summary:
if: true
4 changes: 3 additions & 1 deletion rp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"io"
"net/http"
"net/http/httputil"
"net/url"
"os"
"testing"
Expand Down Expand Up @@ -192,7 +193,8 @@ func TestHTTPSRouting(t *testing.T) {
return
}
if tt.wantErr {
t.Error("want error")
b, _ := httputil.DumpResponse(resp, true)

Check failure on line 196 in rp_test.go

View workflow job for this annotation

GitHub Actions / Test

[gostyle.handlerrors] Do not discard errors using `_` variables. If a function returns an error, check it to make sure the function succeeded. Handle the error, return it, or, in truly exceptional situations, panic. (ref: https://github.com/golang/go/wiki/CodeReviewComments#handle-errors )
t.Errorf("want error, got resp:\n%s", string(b))
return
}
defer resp.Body.Close()
Expand Down

0 comments on commit d6c18d5

Please sign in to comment.