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
90 changes: 43 additions & 47 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/river_dev?sslmode=disable

# Test database.
TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/river_test?sslmode=disable
TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/river_test?pool_max_conns=15&sslmode=disable

on:
push:
Expand Down Expand Up @@ -42,6 +42,13 @@ jobs:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
# Left as a reminder that it might not be a bad idea to increase max
# connections and then increase the maximum allowed in the databaes
# pools for each package under tests. This config is only supported on
# Postgres 16+ though, and changing Postgres configuration on any
# version before that is absurdly difficult through Docker, so it
# might be worth just waiting until <16 have rolled off.
# POSTGRES_INITDB_ARGS: "-c max_connections=1500"
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
Expand All @@ -62,42 +69,11 @@ jobs:
- name: Display Go version
run: go version

- name: Set up test DBs
run: go run ./internal/cmd/testdbman create
env:
PGHOST: 127.0.0.1
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGSSLMODE: disable
- name: Set up database
run: psql -c "CREATE DATABASE river_test" $ADMIN_DATABASE_URL

- name: Test
working-directory: .
run: go test -p 1 -race ./... -timeout 2m

- name: Test cmd/river
working-directory: ./cmd/river
run: go test -race ./... -timeout 2m

- name: Test riverdriver
working-directory: ./riverdriver
run: go test -race ./... -timeout 2m

- name: Test riverdriver/riverdatabasesql
working-directory: ./riverdriver/riverdatabasesql
run: go test -race ./... -timeout 2m

- name: Test riverdriver/riverpgxv5
working-directory: ./riverdriver/riverpgxv5
run: go test -race ./... -timeout 2m

- name: Test rivershared
working-directory: ./rivershared
run: go test -race ./... -timeout 2m

- name: Test rivertype
working-directory: ./rivertype
run: go test -race ./... -timeout 2m
run: make test/race

cli:
strategy:
Expand Down Expand Up @@ -157,21 +133,16 @@ jobs:

- run: river migrate-get --all --exclude-version 1 --up

- name: river migrate-up
run: river migrate-up --database-url $DATABASE_URL
shell: bash
- run: river migrate-up --database-url $DATABASE_URL
shell: bash # needed for windows to interpret env var

- name: river migrate-list
run: river migrate-list --database-url $DATABASE_URL
- run: river migrate-list --database-url $DATABASE_URL
shell: bash

- name: river validate
run: river validate --database-url $DATABASE_URL
- run: river validate --database-url $DATABASE_URL
shell: bash

- name: river version
run: river version
shell: bash
- run: river version

- name: river bench
run: |
Expand All @@ -196,8 +167,7 @@ jobs:
fi
shell: bash

- name: river migrate-down
run: river migrate-down --database-url $DATABASE_URL --max-steps 100
- run: river migrate-down --database-url $DATABASE_URL --max-steps 100
shell: bash

- name: river validate (expect failure)
Expand All @@ -214,6 +184,32 @@ jobs:
fi
shell: bash

#
# Run the whole migration loop again, this time with a custom schema.
#

- run: echo "CUSTOM_SCHEMA=custom_schema" >> $GITHUB_ENV
shell: bash

- run: psql -c "CREATE SCHEMA $CUSTOM_SCHEMA" $DATABASE_URL
shell: bash

- run: river migrate-up --database-url $DATABASE_URL --schema $CUSTOM_SCHEMA
shell: bash

- run: river validate --database-url $DATABASE_URL --schema $CUSTOM_SCHEMA
shell: bash

- run: river migrate-down --database-url $DATABASE_URL --max-steps 100 --schema $CUSTOM_SCHEMA
shell: bash

- name: river validate (expect failure)
run: |
if river validate --database-url $DATABASE_URL --schema $CUSTOM_SCHEMA; then
echo "expected non-zero exit code" && exit 1
fi
shell: bash

golangci:
name: lint
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ linters:
- r
- sb # common convention for string builder
- t
- tb
- tt # common convention for table tests
- tx
- w
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

⚠️ Internal APIs used for communication between River and River Pro have changed. If using River Pro, make sure to update River and River Pro to latest at the same time to get compatible versions.

### Added

- Added `river/riverlog` containing middleware that injects a context logger to workers that collates log output and persists it with job metadata. This is paired with a River UI enhancement that shows logs in the UI. [PR #844](https://github.com/riverqueue/river/pull/844).
- Added `JobInsertMiddlewareFunc` and `WorkerMiddlewareFunc` to easily implement middleware with a function instead of a struct. [PR #844](https://github.com/riverqueue/river/pull/844).
- Added `Config.Schema` which lets a non-default schema be injected explicitly into a River client that'll be used for all database operations. This may be particularly useful for proxies like PgBouncer that may not respect a schema configured in `search_path`. [PR #848](https://github.com/riverqueue/river/pull/848).

### Changed

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ $(foreach mod,$(submodules),$(eval $(call lint-target,$(mod))))
.PHONY: test
test:: ## Run test suite for all submodules
define test-target
test:: ; cd $1 && go test ./... -p 1
test:: ; cd $1 && go test ./... -timeout 2m
endef
$(foreach mod,$(submodules),$(eval $(call test-target,$(mod))))

.PHONY: test/race
test/race:: ## Run test suite for all submodules with race detector
define test-race-target
test/race:: ; cd $1 && go test ./... -p 1 -race
test/race:: ; cd $1 && go test ./... -race -timeout 2m
endef
$(foreach mod,$(submodules),$(eval $(call test-race-target,$(mod))))

Expand Down
Loading
Loading