Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 56 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,75 @@
pull_request:

jobs:
benchmark:
env:
# The special value "local" tells Go to use the bundled Go version rather
# than trying to fetch one according to a `toolchain` value in `go.mod`.
# This ensures that we're really running the Go version in the CI matrix
# rather than one that the Go command has upgraded to automatically.
GOTOOLCHAIN: local
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.26"
postgres-version: [17]
fail-fast: false
timeout-minutes: 5

services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 2s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@v6

- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}

- name: Display Go version
run: go version

- name: Set up database
run: psql -c "CREATE DATABASE river_test" $ADMIN_DATABASE_URL

- name: Benchmark
run: make bench ITERATIONS=1

build_and_test:
env:
# The special value "local" tells Go to use the bundled Go version rather
# than trying to fetch one according to a `toolchain` value in `go.mod`.
# This ensures that we're really running the Go version in the CI matrix
# rather than one that the Go command has upgraded to automatically.
GOTOOLCHAIN: local
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Run the latest Go version against all supported Postgres versions:
- go-version: "1.26"
postgres-version: 18
- go-version: "1.26"
postgres-version: 17
- go-version: "1.26"
postgres-version: 16
- go-version: "1.26"
postgres-version: 15
- go-version: "1.26"
postgres-version: 14

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
# Also run the previous Go version (the Go version previous to current
# is the only other officially supported Go version) against the
# latest Postgres version:
Expand Down Expand Up @@ -69,10 +115,10 @@
- 5432:5432

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -94,12 +140,12 @@
timeout-minutes: 10

steps:
- uses: ikalnytskyi/action-setup-postgres@v6
- uses: ikalnytskyi/action-setup-postgres@v8
with:
database: river_dev
password: postgres

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version: "stable"
check-latest: true
Expand All @@ -120,7 +166,7 @@
shell: pwsh

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: export RIVER_CMD_DIR
run: |
Expand Down Expand Up @@ -260,13 +306,13 @@
pull-requests: read

steps:
- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version: "stable"
check-latest: true

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Lint
uses: golangci/golangci-lint-action@v9
Expand All @@ -290,7 +336,7 @@

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup sqlc
uses: sqlc-dev/setup-sqlc@v4
Expand All @@ -311,13 +357,13 @@
runs-on: ubuntu-latest

steps:
- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version: "stable"
check-latest: true

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Check all go/toolchain directives match
run: CHECK=true make update-mod-go
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ help: ## Print this message
# workspace with `go work use ./driver/new`.
submodules := $(shell go list -f '{{.Dir}}' -m)

ITERATIONS ?= 100

# Definitions of following tasks look ugly, but they're done this way because to
# produce the best/most comprehensible output by far (e.g. compared to a shell
# loop).
Expand All @@ -65,6 +67,13 @@ define test-race-target
endef
$(foreach mod,$(submodules),$(eval $(call test-race-target,$(mod))))

.PHONY: bench
bench:: ## Run benchmarks in each submodule (ITERATIONS=100)
define bench-target
bench:: ; cd $1 && go test -bench=. -benchtime=$(ITERATIONS)x -run=a^ ./...
endef
$(foreach mod,$(submodules),$(eval $(call bench-target,$(mod))))

.PHONY: tidy
tidy:: ## Run `go mod tidy` for all submodules
define tidy-target
Expand Down
2 changes: 2 additions & 0 deletions riverdriver/riverdrivertest/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ func BenchmarkDriverRiverPgxV5_Executor(b *testing.B) {
ClientID: clientID,
MaxToLock: 100,
Queue: river.QueueDefault,
Schema: bundle.schema,
}); err != nil {
b.Fatal(err)
}
Expand All @@ -467,6 +468,7 @@ func BenchmarkDriverRiverPgxV5_Executor(b *testing.B) {
ClientID: clientID,
MaxToLock: 100,
Queue: river.QueueDefault,
Schema: bundle.schema,
}); err != nil {
b.Fatal(err)
}
Expand Down
Loading