Skip to content

Commit

Permalink
Merge pull request #127 from isucon/post-ci-result-on-bench
Browse files Browse the repository at this point in the history
Post ci result on bench
  • Loading branch information
fujiwara authored Jul 1, 2022
2 parents 1ff80f4 + 41f1946 commit 9682f71
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/full.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Full Test
on: [push]
on: [pull_request]
jobs:
test:
strategy:
Expand Down Expand Up @@ -34,6 +34,12 @@ jobs:
- name: setup tools
run: |
sudo apt-get update && sudo apt-get install -y mysql-client-8.0 sqlite3
gh version && exit 0
cd /tmp
curl -sLO https://github.com/cli/cli/releases/download/v2.13.0/gh_2.13.0_linux_amd64.tar.gz
tar xf gh_2.13.0_linux_amd64.tar.gz
sudo install gh_2.13.0_linux_amd64/bin/gh /usr/local/bin
gh version
- name: "build initial data"
working-directory: ./data
Expand All @@ -51,7 +57,10 @@ jobs:
- name: "run bench(default)"
working-directory: ./bench
run: |
make ci
make ci-with-comment
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# 2coreのself hosted runnerに限りがあるので一時コメントアウト
# - name: "前ベンチが完全にタイムアウトするまで少しだけ待つ"
Expand Down
2 changes: 1 addition & 1 deletion bench/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bench
./bench
benchmarker*.json
6 changes: 5 additions & 1 deletion bench/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ prepare: bench
./bench -duration 5s

ci: bench
./bench -target-addr 127.0.0.1:3000 -target-url http://t.isucon.dev
rm -f ci.log
./bench -target-addr 127.0.0.1:3000 -target-url http://t.isucon.dev | tee ci.log

ci-with-comment: ci
gh issue comment --body-file ci.log $$(echo $$GITHUB_REF_NAME | sed -e 's/\/merge//')

ci-loadtype-light: bench
./bench -target-addr 127.0.0.1:3000 -target-url http://t.isucon.dev -load-type light
Expand Down
13 changes: 12 additions & 1 deletion bench/cmd/bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"math/rand"
"os"
"sort"
"time"

"github.com/isucon/isucandar"
Expand Down Expand Up @@ -104,7 +105,17 @@ func main() {
scenario.PrintScenarioCount()
score, addition, deduction := SumScore(result)
bench.ContestantLogger.Printf("SCORE: %d (+%d %d)", score, addition, -deduction)
bench.ContestantLogger.Printf("RESULT: %#v", AllTagBreakdown(result))
br := AllTagBreakdown(result)
tags := make([]string, 0, len(br))
for tag, score := range br {
tags = append(tags, fmt.Sprintf("%s: %d", tag, score))
}
sort.Slice(tags, func(i, j int) bool {
return tags[i] < tags[j]
})
for _, tag := range tags {
fmt.Println(tag)
}
bench.AdminLogger.Printf("%s", pp.Sprint(AllTagBreakdown(result)))

// 0点以下(fail)ならエラーで終了
Expand Down

0 comments on commit 9682f71

Please sign in to comment.