forked from qiangxue/go-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (57 loc) · 1.97 KB
/
codspeed.yml
File metadata and controls
68 lines (57 loc) · 1.97 KB
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
name: CodSpeed Benchmarks
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
jobs:
benchmarks:
name: Run benchmarks
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: go_restful
ports:
- 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
id: go
- name: Set up Go environment paths
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- name: Get Go dependencies
run: |
go mod download
go mod verify
go get golang.org/x/tools/cmd/cover
go get golang.org/x/lint/golint
- name: Set up database environment
env:
APP_DSN: postgres://127.0.0.1:${{ job.services.postgres.ports[5432] }}/go_restful?sslmode=disable&user=postgres&password=postgres
run: |
echo "APP_DSN=postgres://127.0.0.1:${{ job.services.postgres.ports[5432] }}/go_restful?sslmode=disable&user=postgres&password=postgres" >> $GITHUB_ENV
echo "APP_JWT_SIGNING_KEY=test-key-for-benchmarks" >> $GITHUB_ENV
- name: Run database migrations
env:
APP_DSN: postgres://127.0.0.1:${{ job.services.postgres.ports[5432] }}/go_restful?sslmode=disable&user=postgres&password=postgres
run: make migrate
- name: Verify benchmarks compile
run: go test -c -o /dev/null ./benchmarks/...
- name: Run CodSpeed benchmarks
uses: CodSpeedHQ/action@v4
with:
mode: walltime
runner-version: latest
run: go test -bench=. ./benchmarks/...