-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a docker image for CI #1633
base: develop
Are you sure you want to change the base?
Add a docker image for CI #1633
Conversation
A basic image with all the requirements to build a PGRX project in a CI job. This saves a lot of CI minutes, especially the `cargo pgrx init` step which is quite long. By default, the image is based on the latest version available but it can be overriden with `--build-arg PGRX_VERSION=0.11.3`
@daamien Could you add a workflow in that actually would use this? It's not enough to just put it in the CI folder, gotta actually make it part of the tests. |
And I don't mean a workflow to put it on DockerHub or whatever, I mean something that would use it to run the test suite on top of it. |
@daamien We don't run the slow The downside of using a prebuilt postgres is that it doesn't have debug-asserts enabled. In practice this is kind of fine but is a real deficiency in our CI flow. Unfortunately fixing this requires (as you mentioned) uploading the container to something like dockerhub or (more likely for our case, for trust reasons) GHCR. All this isn't trivial. |
does it require the upload first? 😵💫 gah. |
Thanks for the feedback ! What is the problem with uploading the image to a registry ? The image will be quite big ( roughly 1,5Go ) but the upload would happen only when a tag is pushed on the PGRX repo. So once a month, or so. That seems acceptable. Anyway I think it's also possible to let dockerhub build the image (via a webhook) and in that case there's no upload at all.... Regarding the examples of CI configuration, I work mostly on gitlab.com and I have some custom jobs that wouldn't apply for a general usage, but I guess that the job below would be a good example to start with: pgrx:test:
stage: test
image: pgcentralfoundation/pgrx:0.11.3
script:
- cargo pgrx test $PGVER --verbose
parallel:
matrix:
- PGVER: pg12
- PGVER: pg13
- PGVER: pg14
- PGVER: pg15
- PGVER: pg16 I'm less familiar with github actions, but it would look like this name: PGRX tests
on: [push]
jobs:
test:
strategy:
matrix:
pgver: [pg12, pg13, pg14, pg15, pg16 ]
name: PGRX tests on ${{ matrix.pgver }}
runs-on: ubuntu-latest
container: pgcentralfoundation/pgrx:0.11.3
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Test on ${{ matrix.pgver }}
run: cargo pgrx test ${{ matrix.pgver }} --verbose |
Unfortunately I don't think this image will work for GitHub actions due to /actions/checkout#956: You can't checkout a repo unless you run as |
There's also this bit of documentation:
Ultimately we're going to have to create a GitHub action in JavaScript I think. :-( |
With the new |
Following a discussion on the discord channel:
Here's a basic docker image with all the requirements to build a PGRX project in a CI job. This saves a lot of CI minutes, especially the
cargo pgrx init
step which is quite long.By default, the image is based on the latest version available but it can be overriden with
--build-arg PGRX_VERSION=0.11.3
This could be completed with a CI action to build and push the image automatically on dockerhub, like this
https://github.com/daamien/docker-pgrx/blob/latest/.github/workflows/build-push.yaml
This would require to add secrets variables in the Github account for
DOCKERHUB_USERNAME
andDOCKERHUB_TOKEN
This would also provide an easy way to test against alpha/beta versions by simply pulling any version like this
docker pull pgcentralfoundation/pgrx:0.12.0-alpha.1