Skip to content

Commit

Permalink
Parallelize builds (#100)
Browse files Browse the repository at this point in the history
Previously the dev build pipelines would build the images for each PG
version sequentially. This changes it to build them in parallel. To make
sure that we only have to update postgres versions in one place, these
are now moved to a separate file, which is then read by both the CI and
the makefile.
  • Loading branch information
JelteF authored Feb 9, 2023
1 parent a40ca0b commit 6f2b4b9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/build-test-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,56 @@ on:
workflow_dispatch:

jobs:
build_dev_images:
prepare_pgversion_matrix:
runs-on: ubuntu-latest
steps:
# Need the repo checked out in order to read the file
- uses: actions/checkout@v3
- id: get_versions
run: cat circleci/images/PG_VERSIONS >> $GITHUB_OUTPUT
outputs:
# Will look like '["13.9", "14.6", "15.1"]'
pgversions: ${{ toJSON(steps.get_versions.outputs.*) }}

build_dev_images_per_postgres:
if: github.ref_name != 'master'
name: push-test-images-for-dev
runs-on: ubuntu-latest
needs:
- prepare_pgversion_matrix
strategy:
fail-fast: false
matrix:
command:
- extbuilder
- exttester
- failtester
pgversion: ${{ fromJSON(needs.prepare_pgversion_matrix.outputs.pgversions) }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER_NAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

# If current branch is not master,build and publish dev image
- name: Build & Push all dev images
run: |
cd circleci/images
make push-${{ matrix.command }}-${{ matrix.pgversion }}
build_dev_images_shared:
if: github.ref_name != 'master'
name: push-test-images-for-dev
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
command:
- citusupgradetester
- pgupgradetester
- stylechecker
Expand All @@ -39,6 +78,7 @@ jobs:
cd circleci/images
make push-${{ matrix.command }}-all
build_release_images:
if: github.ref_name == 'master'
name: push-test-images-for-release
Expand Down
2 changes: 1 addition & 1 deletion circleci/images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ else
endif

# all postgres versions we test against
PG_VERSIONS=13.9 14.6 15.1
PG_VERSIONS=$(shell cat PG_VERSIONS|cut -c 6-|tr '\n' ' ' )

PG_UPGRADE_TESTER_VERSION=$(shell echo ${PG_VERSIONS}|tr ' ' '-'|sed 's/~//g')

Expand Down
3 changes: 3 additions & 0 deletions circleci/images/PG_VERSIONS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PG13=13.9
PG14=14.6
PG15=15.1

0 comments on commit 6f2b4b9

Please sign in to comment.