Skip to content
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

Older PG compat #1306

Merged
merged 5 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,46 @@ jobs:
path: .coverage.${{ matrix.python-version }}
include-hidden-files: true

older-db-versions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit weary of adding so many tests. What about changing the existing python matrix so that at the same time as we test old python versions, we test old postgres too ?

Copy link
Member

@medihack medihack Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first version exactly did this, but I did not like it. I don't want to run coverage or upload artifacts. Of course, one can do this conditionally, but the job becomes more complicated. Also, the matrix itself becomes more complex as we want to test every Python version, but not every Python version against every database version. So, overall, I find a separate job more clear.
But I can implement it in my other PR (#1307) how it would look like.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it would look something like this then. Do you think it's better? Or do you have something else in mind?
The --cov quite matters (running the whole test suite on my Laptop 47s vs 55s).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Xowap I understood ewjoachim wrong, but his suggestion makes total sense now. Would you mind adapting the CI code to something like this: https://github.com/procrastinate-org/procrastinate/pull/1307/files
Sorry for the extra work and that I didn't think of it myself 🤦.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Xowap I had some time left and quickly changed it 🙂.

strategy:
matrix:
postgres-version:
- "13"
- "14"
- "15"
- "16"

name: "postgres-${{ matrix.postgres-version }}"
runs-on: ubuntu-latest

services:
postgres:
image: postgres:${{ matrix.postgres-version }}
# Set health checks to wait until postgres has started
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
ports:
- 5432:5432

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Install the latest version of uv
uses: astral-sh/setup-uv@b5f58b2abc5763ade55e4e9d0fe52cd1ff7979ca # v5
with:
python-version: "3.13"

- name: Run tests
run: uv run pytest
env:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres

acceptance:
strategy:
matrix:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ AS $$
DECLARE
payload TEXT;
BEGIN
SELECT json_object('type': 'job_inserted', 'job_id': NEW.id)::text INTO payload;
SELECT json_build_object('type', 'job_inserted', 'job_id', NEW.id)::text INTO payload;
PERFORM pg_notify('procrastinate_queue_v1#' || NEW.queue_name, payload);
PERFORM pg_notify('procrastinate_any_queue_v1', payload);
RETURN NEW;
Expand All @@ -282,7 +282,7 @@ AS $$
DECLARE
payload TEXT;
BEGIN
SELECT json_object('type': 'abort_job_requested', 'job_id': NEW.id)::text INTO payload;
SELECT json_build_object('type', 'abort_job_requested', 'job_id', NEW.id)::text INTO payload;
PERFORM pg_notify('procrastinate_queue_v1#' || NEW.queue_name, payload);
PERFORM pg_notify('procrastinate_any_queue_v1', payload);
RETURN NEW;
Expand Down
4 changes: 2 additions & 2 deletions procrastinate/sql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ AS $$
DECLARE
payload TEXT;
BEGIN
SELECT json_object('type': 'job_inserted', 'job_id': NEW.id)::text INTO payload;
SELECT json_build_object('type', 'job_inserted', 'job_id', NEW.id)::text INTO payload;
PERFORM pg_notify('procrastinate_queue_v1#' || NEW.queue_name, payload);
PERFORM pg_notify('procrastinate_any_queue_v1', payload);
RETURN NEW;
Expand All @@ -316,7 +316,7 @@ AS $$
DECLARE
payload TEXT;
BEGIN
SELECT json_object('type': 'abort_job_requested', 'job_id': NEW.id)::text INTO payload;
SELECT json_build_object('type', 'abort_job_requested', 'job_id', NEW.id)::text INTO payload;
PERFORM pg_notify('procrastinate_queue_v1#' || NEW.queue_name, payload);
PERFORM pg_notify('procrastinate_any_queue_v1', payload);
RETURN NEW;
Expand Down
Loading