From 31ead3d8071555c65facdd10483f7703c4323a7c Mon Sep 17 00:00:00 2001 From: Andrew Ross Date: Sat, 29 Jul 2023 18:04:51 -0400 Subject: [PATCH] Adds matrix pg_version for ci test command --- .ci/docker-compose.yml | 2 ++ .github/workflows/test.yml | 16 +++++++++------- dockerfiles/db/Dockerfile | 7 ++++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.ci/docker-compose.yml b/.ci/docker-compose.yml index 3ea349e0..bd574344 100644 --- a/.ci/docker-compose.yml +++ b/.ci/docker-compose.yml @@ -6,5 +6,7 @@ services: build: context: .. dockerfile: ./dockerfiles/db/Dockerfile + args: + PG_VERSION: ${PG_VERSION:-15} command: - ./bin/installcheck diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 07f132d1..09ce382b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,14 +6,16 @@ on: jobs: test: name: Run tests + strategy: + matrix: + postgres: [14, 15] runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 - - name: Build docker images - run: docker-compose -f .ci/docker-compose.yml build + - name: Build docker images + run: PG_VERSION=${{ matrix.postgres }} docker-compose -f .ci/docker-compose.yml build - - name: Run tests - run: docker-compose -f .ci/docker-compose.yml run test + - name: Run tests + run: PG_VERSION=${{ matrix.postgres }} docker-compose -f .ci/docker-compose.yml run test diff --git a/dockerfiles/db/Dockerfile b/dockerfiles/db/Dockerfile index dc098ab9..ac988dcb 100644 --- a/dockerfiles/db/Dockerfile +++ b/dockerfiles/db/Dockerfile @@ -1,11 +1,12 @@ -FROM postgres:15 +ARG PG_VERSION=15 +FROM postgres:${PG_VERSION} RUN apt-get update ENV build_deps ca-certificates \ git \ build-essential \ libpq-dev \ - postgresql-server-dev-15 \ + postgresql-server-dev-${PG_MAJOR} \ curl \ libreadline6-dev \ zlib1g-dev @@ -29,7 +30,7 @@ RUN \ # PGRX RUN cargo install cargo-pgrx --version 0.9.7 --locked -RUN cargo pgrx init --pg15 $(which pg_config) +RUN cargo pgrx init --pg${PG_MAJOR} $(which pg_config) USER root