Skip to content

Commit a5e6dd3

Browse files
committed
github/workflows: add benchmark workflow
1 parent 4ea5938 commit a5e6dd3

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/benchmark.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Benchmark
2+
3+
on:
4+
push:
5+
branches: "*"
6+
tags:
7+
- "v*"
8+
pull_request:
9+
branches: "*"
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
benchmark:
17+
strategy:
18+
matrix:
19+
os:
20+
# https://github.com/actions/virtual-environments/blob/ubuntu20/20201210.0/images/linux/Ubuntu2004-README.md
21+
- ubuntu-20.04
22+
go-version:
23+
- 1.15.x
24+
runs-on: ${{ matrix.os }}
25+
26+
steps:
27+
- name: Set flag environment variable
28+
run: |
29+
echo "OS=$(echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
30+
echo "GO_VERSION=$(echo ${{ matrix.go-version }} | cut -d. -f-2)" >> $GITHUB_ENV
31+
32+
- name: Install Go
33+
uses: actions/setup-go@v2
34+
with:
35+
go-version: ${{ matrix.go-version }}
36+
37+
- name: Checkout code
38+
uses: actions/checkout@v2
39+
40+
- name: Cache Go module and build cache
41+
uses: actions/cache@v2
42+
with:
43+
key: ${{ env.OS }}-go-${{ hashFiles('**/go.sum') }}
44+
path: |
45+
~/go/pkg/mod # Module download cache
46+
~/.cache/go-build # Build cache (Linux)
47+
restore-keys: |
48+
${{ env.OS }}-go-
49+
50+
- name: Cache nvim binary for linux and darwin
51+
uses: actions/cache@v2
52+
id: cache-nvim
53+
with:
54+
key: ${{ env.OS }}-nvim-${{ hashFiles('~/nvim/bin/nvim') }}
55+
path: |
56+
~/nvim
57+
restore-keys: |
58+
${{ env.OS }}-nvim-
59+
60+
- name: Install nvim binary
61+
uses: rhysd/action-setup-vim@v1
62+
if: steps.cache-nvim.outputs.cache-hit != 'true'
63+
with:
64+
neovim: true
65+
version: nightly
66+
67+
- name: Run Benchmark
68+
run: |
69+
go test -v -count=3 -run=none -bench=. -benchmem -timeout=15m ./... | tee bench-${{ env.OS }}-${{ env.GO_VERSION }}.txt
70+
71+
- name: 'Upload benchmark Artifact'
72+
uses: actions/upload-artifact@v2
73+
with:
74+
name: bench-${{ env.OS }}-${{ env.GO_VERSION }}.txt
75+
path: bench-${{ env.OS }}-${{ env.GO_VERSION }}.txt

0 commit comments

Comments
 (0)