Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20e59e0

Browse files
authored
ci: test with multiple postgres versions (#13665)
- Tests now run on postgres 16 by default when run locally (can be specified with POSTGRES_VERSION)- Adds test-go-pg-16 to test against postgres version 16- Updates Dogfood dockerfile / nix flake to postgres version 16- Updates docker-compose.yaml postgres tag to 16
1 parentd5d8b91 commit20e59e0

File tree

5 files changed

+55
-10
lines changed

5 files changed

+55
-10
lines changed

‎.github/workflows/ci.yaml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,50 @@ jobs:
354354
uses:./.github/actions/setup-tf
355355

356356
-name:Test with PostgreSQL Database
357+
env:
358+
POSTGRES_VERSION:"13"
359+
TS_DEBUG_DISCO:"true"
360+
run:|
361+
make test-postgres
362+
363+
-name:Upload test stats to Datadog
364+
timeout-minutes:1
365+
continue-on-error:true
366+
uses:./.github/actions/upload-datadog
367+
if:success() || failure()
368+
with:
369+
api-key:${{ secrets.DATADOG_API_KEY }}
370+
371+
# NOTE: this could instead be defined as a matrix strategy, but we want to
372+
# only block merging if tests on postgres 13 fail. Using a matrix strategy
373+
# here makes the check in the above `required` job rather complicated.
374+
test-go-pg-16:
375+
runs-on:${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
376+
needs:
377+
-changes
378+
if:needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
379+
# This timeout must be greater than the timeout set by `go test` in
380+
# `make test-postgres` to ensure we receive a trace of running
381+
# goroutines. Setting this to the timeout +5m should work quite well
382+
# even if some of the preceding steps are slow.
383+
timeout-minutes:25
384+
steps:
385+
-name:Checkout
386+
uses:actions/checkout@v4
387+
with:
388+
fetch-depth:1
389+
390+
-name:Setup Go
391+
uses:./.github/actions/setup-go
392+
393+
-name:Setup Terraform
394+
uses:./.github/actions/setup-tf
395+
396+
-name:Test with PostgreSQL Database
397+
env:
398+
POSTGRES_VERSION:"16"
399+
TS_DEBUG_DISCO:"true"
357400
run:|
358-
export TS_DEBUG_DISCO=true
359401
make test-postgres
360402
361403
-name:Upload test stats to Datadog

‎Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ GOOS := $(shell go env GOOS)
3636
GOARCH :=$(shell go env GOARCH)
3737
GOOS_BIN_EXT :=$(if$(filter windows,$(GOOS)),.exe,)
3838
VERSION :=$(shell ./scripts/version.sh)
39+
POSTGRES_VERSION ?= 16
3940

4041
# Use the highest ZSTD compression level in CI.
4142
ifdefCI
@@ -814,19 +815,19 @@ test-migrations: test-postgres-docker
814815

815816
# NOTE: we set --memory to the same size as a GitHub runner.
816817
test-postgres-docker:
817-
docker rm -f test-postgres-docker||true
818+
docker rm -f test-postgres-docker-${POSTGRES_VERSION}||true
818819
docker run\
819820
--env POSTGRES_PASSWORD=postgres\
820821
--env POSTGRES_USER=postgres\
821822
--env POSTGRES_DB=postgres\
822823
--env PGDATA=/tmp\
823824
--tmpfs /tmp\
824825
--publish 5432:5432\
825-
--name test-postgres-docker\
826+
--name test-postgres-docker-${POSTGRES_VERSION}\
826827
--restart no\
827828
--detach\
828829
--memory 16GB\
829-
gcr.io/coder-dev-1/postgres:13\
830+
gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION}\
830831
-c shared_buffers=1GB\
831832
-c work_mem=1GB\
832833
-c effective_cache_size=1GB\

‎docker-compose.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ services:
2525
database:
2626
condition:service_healthy
2727
database:
28-
image:"postgres:14.2"
28+
# Minimum supported version is 13.
29+
# More versions here: https://hub.docker.com/_/postgres
30+
image:"postgres:16"
2931
ports:
3032
-"5432:5432"
3133
environment:

‎dogfood/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ RUN apt-get update --quiet && apt-get install --yes \
146146
openssl \
147147
packer \
148148
pkg-config \
149-
postgresql-13 \
149+
postgresql-16 \
150150
python3 \
151151
python3-pip \
152152
rsync \
@@ -209,8 +209,8 @@ RUN apt-get update && \
209209
npm cache clean --force
210210

211211
# Ensure PostgreSQL binaries are in the users $PATH.
212-
RUN update-alternatives --install /usr/local/bin/initdb initdb /usr/lib/postgresql/13/bin/initdb 100 && \
213-
update-alternatives --install /usr/local/bin/postgres postgres /usr/lib/postgresql/13/bin/postgres 100
212+
RUN update-alternatives --install /usr/local/bin/initdb initdb /usr/lib/postgresql/16/bin/initdb 100 && \
213+
update-alternatives --install /usr/local/bin/postgres postgres /usr/lib/postgresql/16/bin/postgres 100
214214

215215
# Create links for injected dependencies
216216
RUN ln --symbolic /var/tmp/coder/coder-cli/coder /usr/local/bin/coder && \

‎flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
pixman
6060
pkg-config
6161
playwright-driver.browsers
62-
postgresql_13
62+
postgresql_16
6363
protobuf
6464
protoc-gen-go
6565
ripgrep
@@ -97,7 +97,7 @@
9797
name="coder-${osArch}";
9898
# Updated with ./scripts/update-flake.sh`.
9999
# This should be updated whenever go.mod changes!
100-
vendorHash="sha256-+K95kbYNMKiYk7obN2gjNCtBvaXBWPLKm12N6cF9ImQ=";
100+
vendorHash="sha256-e0L6osJwG0EF0M3TefxaAjDvN4jvQHxTGEUEECNO1Vw=";
101101
proxyVendor=true;
102102
src=./.;
103103
nativeBuildInputs=withpkgs;[getoptopensslzstd];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp