From ed81a6e243bc272612a6dcf9e195d862490421c1 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 9 Jan 2024 11:27:04 +0100 Subject: [PATCH] build the container for multiple PostgreSQL versions --- .github/workflows/container-release.yml | 11 ++++++++++- .github/workflows/container.yml | 13 +++++++++++-- Containerfile | 3 ++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml index 753610a..291f2d7 100644 --- a/.github/workflows/container-release.yml +++ b/.github/workflows/container-release.yml @@ -15,6 +15,13 @@ jobs: permissions: contents: read packages: write + strategy: + fail-fast: false + matrix: + postgresql: + - 12 + - 13 + - 15 steps: - name: Checkout repository uses: actions/checkout@v4 @@ -30,7 +37,7 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | - type=raw,value=12 + type=raw,value=${{ matrix.postgresql }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: @@ -39,3 +46,5 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + POSTGRESQL_VERSION=${{ matrix.postgresql }} diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 7e21389..cb1fdf1 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -10,15 +10,24 @@ permissions: jobs: container: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + postgresql: + - 12 + - 13 + - 15 steps: - uses: actions/checkout@v4 - name: Build container uses: docker/build-push-action@v5 with: file: Containerfile - tags: postgresql-evr:latest + tags: postgresql-evr:${{ matrix.postgresql }} + build-args: | + POSTGRESQL_VERSION=${{ matrix.postgresql }} - name: Run container - run: docker run -p 5432:5432 -e POSTGRES_PASSWORD=password --detach --name postgres postgresql-evr:latest + run: docker run -p 5432:5432 -e POSTGRES_PASSWORD=password --detach --name postgres postgresql-evr:${{ matrix.postgresql }} - name: Wait for the container to start up run: 'while ! docker exec postgres pg_isready; do sleep 1; done' - name: Create extension in the container diff --git a/Containerfile b/Containerfile index b661d8f..1c9b6c3 100644 --- a/Containerfile +++ b/Containerfile @@ -1,4 +1,5 @@ -FROM postgres:12 +ARG POSTGRESQL_VERSION=12 +FROM postgres:${POSTGRESQL_VERSION} COPY Makefile *.control *.sql /src/