-
Notifications
You must be signed in to change notification settings - Fork 138
90 lines (84 loc) · 2.77 KB
/
benchmarks.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
name: benchmarks
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
jobs:
benchmarks:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Read go version
id: go-version
shell: bash
run: |
content=`cat ./.go-version`
echo "::set-output name=content::$content"
-
name: Set up Go
uses: actions/setup-go@v3
with:
# TODO: Replace with go-version-from-file when it is supported
# https://github.com/actions/setup-go/pull/62
go-version: ${{ steps.go-version.outputs.content }}
-
name: Go mod download
run: go mod download -x
-
name: Run benchmarks
id: bench
run: |
go test ./internal/langserver/handlers \
-bench=InitializeFolder_basic \
-run=^# \
-benchtime=60s \
-timeout=60m | tee ${{ runner.temp }}/benchmarks.txt
-
name: Evaluate benchmarks
id: bench-eval
run: |
BENCHDATA="go run go.bobheadxi.dev/gobenchdata"
BENCH_PATH="${{ runner.temp }}/benchmarks.txt"
DATA_PATH="${{ runner.temp }}/benchdata.json"
RESULTS_PATH="${{ runner.temp }}/benchdata-results.json"
CHECKS_CONFIG_PATH="${{ github.workspace }}/.github/gobenchdata-checks.yml"
cat $BENCH_PATH | $BENCHDATA --json ${DATA_PATH} -v "${GITHUB_SHA}" -t "ref=${GITHUB_REF}"
$BENCHDATA checks eval \
${DATA_PATH} \
${DATA_PATH} \
--checks.config ${CHECKS_CONFIG_PATH} \
--json ${RESULTS_PATH}
cat $RESULTS_PATH | jq -e '.Status == "pass"'
-
name: Report failures
id: report
if: ${{ failure() && !cancelled() }}
run: |
BENCHDATA="go run go.bobheadxi.dev/gobenchdata"
RESULTS_PATH="${{ runner.temp }}/benchdata-results.json"
$BENCHDATA checks report $RESULTS_PATH
-
name: Upload benchmark data as artifact
if: ${{ always() && !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: benchdata-${{ github.ref_name }}-${{ github.sha }}-${{ github.run_id }}.json
path: "${{ runner.temp }}/benchdata.json"
-
name: Send failures to Slack
if: ${{ failure() && !cancelled() }}
uses: slackapi/[email protected]
with:
payload: |
{
"results_url": "https://github.com/hashicorp/terraform-ls/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.BENCHMARKS_SLACK_WEBHOOK_URL }}