feat/install codspeed #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/... |