Skip to content

Commit d1b78d2

Browse files
committed
Merge remote-tracking branch 'origin/develop' into spi-readonly
2 parents 01d1d24 + 71d8ea0 commit d1b78d2

File tree

97 files changed

+1850
-1574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1850
-1574
lines changed

.github/docker/Dockerfile.alpine:3.16

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,18 @@ ENV USER=rust
4848
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
4949
ENV PATH="/home/rust/.cargo/bin:${PATH}"
5050

51+
# By default, we always want to use '--locked'. However, there are some circumstances
52+
# where we might want to try it unlocked. In those one-off scenarios, the image
53+
# can be built by docker with: --build-arg CARGO_LOCKED_OPTION=''
54+
ARG CARGO_LOCKED_OPTION='--locked'
55+
ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION}
56+
5157
# Install cargo-pgx from source copied into this container
52-
RUN cargo install --path cargo-pgx/ --locked
58+
RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION
5359

5460
# This seems strange, but by this point $PG_MAJOR_VER is blank and
5561
# $PG_MAJOR is always set to the correct version. I think it's something built
5662
# into the postgres:XX-alpine3.16 images, so it was easier to go with the grain
5763
RUN cargo pgx init --pg$PG_MAJOR=$(which pg_config)
5864

59-
CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER}"]
65+
CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER} cshim", "${CARGO_LOCKED_OPTION}"]

.github/docker/Dockerfile.amazon:2

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Example of how to build this container (ran from pgx checkout directory):
2-
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.alpine\:3.16 -t pgx-amazonlinux2 .
2+
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.amazon\:2 -t pgx-amazonlinux2 .
33
#
44
# Example of how to run this container with tests after building the image:
55
# docker run pgx-amazonlinux2 cargo test --no-default-features --features pg14 --locked
@@ -75,9 +75,20 @@ ENV USER=rust
7575

7676
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
7777
ENV PATH="/home/rust/.cargo/bin:${PATH}"
78-
RUN cargo install --path cargo-pgx/ --locked
78+
79+
# By default, we always want to use '--locked'. However, there are some circumstances
80+
# where we might want to try it unlocked. In those one-off scenarios, the image
81+
# can be built by docker with: --build-arg CARGO_LOCKED_OPTION=''
82+
ARG CARGO_LOCKED_OPTION='--locked'
83+
ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION}
84+
85+
# Install cargo-pgx from source copied into this container
86+
RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION
87+
88+
# Initialize cargo pgx so that we can run the tests
7989
RUN cargo pgx init --pg$PG_MAJOR_VER=$(which pg_config)
80-
CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER}"]
90+
91+
CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER} cshim", "${CARGO_LOCKED_OPTION}"]
8192

8293
# === Previous "amazon-linux-extras" steps, kept for historical purposes ===
8394
# RUN amazon-linux-extras enable postgresql$PG_MAJOR_VER

.github/docker/Dockerfile.debian:bullseye

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Example of how to build this container (ran from pgx checkout directory):
2-
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.alpine\:3.16 -t pgx-debian.
2+
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.debian\:bullseye -t pgx-debian .
33
#
44
# Example of how to run this container with tests after building the image:
55
# docker run pgx-debian cargo test --no-default-features --features pg14 --locked
@@ -54,10 +54,16 @@ ENV USER=rust
5454
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5555
ENV PATH="/home/rust/.cargo/bin:${PATH}"
5656

57+
# By default, we always want to use '--locked'. However, there are some circumstances
58+
# where we might want to try it unlocked. In those one-off scenarios, the image
59+
# can be built by docker with: --build-arg CARGO_LOCKED_OPTION=''
60+
ARG CARGO_LOCKED_OPTION='--locked'
61+
ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION}
62+
5763
# Install cargo-pgx from source copied into this container
58-
RUN cargo install --path cargo-pgx/ --locked
64+
RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION
5965

6066
# Initialize cargo pgx so that we can run the tests
6167
RUN cargo pgx init --pg$PG_MAJOR_VER=$(which pg_config)
6268

63-
CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER}"]
69+
CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER} cshim", "${CARGO_LOCKED_OPTION}"]

.github/docker/Dockerfile.fedora:36

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Example of how to build this container (ran from pgx checkout directory):
2-
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.alpine\:3.16 -t pgx-fedora .
2+
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.fedora\:36 -t pgx-fedora .
33
#
44
# Example of how to run this container with tests after building the image:
55
# docker run pgx-fedora cargo test --no-default-features --features pg14 --locked
@@ -45,10 +45,16 @@ ENV USER=rust
4545
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
4646
ENV PATH="/home/rust/.cargo/bin:${PATH}"
4747

48+
# By default, we always want to use '--locked'. However, there are some circumstances
49+
# where we might want to try it unlocked. In those one-off scenarios, the image
50+
# can be built by docker with: --build-arg CARGO_LOCKED_OPTION=''
51+
ARG CARGO_LOCKED_OPTION='--locked'
52+
ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION}
53+
4854
# Install cargo-pgx from source copied into this container
49-
RUN cargo install --path cargo-pgx/ --locked
55+
RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION
5056

5157
# Initialize cargo pgx so that we can run the tests
5258
RUN cargo pgx init --pg$PG_MAJOR_VER=/usr/pgsql-$PG_MAJOR_VER/bin/pg_config
5359

54-
CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER}"]
60+
CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER} cshim", "${CARGO_LOCKED_OPTION}"]

.github/docker/run-docker.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
#! /usr/bin/env bash
22

3+
# Environment variables:
4+
# PG_MAJOR_VER: The major version of Postgres in which to build/run. E.g. 14, 12, 15
5+
# DOCKERFILE_ID: The Dockerfile identifier to be built, included in this repo,
6+
# e.g. debian:bullseye or amazon:2
7+
# CARGO_LOCKED_OPTION: Set to '--locked' to use "cargo --locked", or set to
8+
# blank '' to use "cargo" without "--locked"
9+
10+
# Examples of running this script in CI (currently Github Actions):
11+
# ./.github/docker/run-docker.sh 14 debian:bullseye
12+
# ./.github/docker/run-docker.sh 12 fedora:36
13+
14+
set -x
15+
316
PG_MAJOR_VER=$1
417
DOCKERFILE_ID=$2
518

619
echo "Building docker container for PGX using Postgres version $PG_MAJOR_VER in container $DOCKERFILE_ID"
20+
echo "Cargo lock flag set to: '$CARGO_LOCKED_OPTION'"
721

822
docker build \
9-
--build-arg PG_MAJOR_VER=$PG_MAJOR_VER \
10-
-t pgx -f ".github/docker/Dockerfile.$DOCKERFILE_ID" .
23+
--build-arg PG_MAJOR_VER="$PG_MAJOR_VER" \
24+
--build-arg CARGO_LOCKED_OPTION="$CARGO_LOCKED_OPTION" \
25+
-t pgx \
26+
-f ".github/docker/Dockerfile.$DOCKERFILE_ID" \
27+
.
1128

12-
echo "Running PGX test suite using Postgres version $PG_MAJOR_VER in container $DOCKERFILE_ID"
29+
echo "Running PGX test suite using Postgres version $PG_MAJOR_VER in container $DOCKERFILE_ID with 'cshim'"
1330

14-
docker run pgx cargo test --no-default-features --features pg$PG_MAJOR_VER --locked
31+
docker run pgx \
32+
cargo test \
33+
--no-default-features \
34+
--features "pg$PG_MAJOR_VER cshim" \
35+
"$CARGO_LOCKED_OPTION"

.github/workflows/tests.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,25 @@ jobs:
126126
- name: Run base-level tests
127127
run: |
128128
cargo test \
129-
--features "pg$PG_VER" --no-default-features \
129+
--features "pg$PG_VER" \
130130
--package cargo-pgx \
131131
--package pgx \
132132
--package pgx-macros \
133133
--package pgx-pg-sys \
134-
--package pgx-tests \
135134
--package pgx-sql-entity-graph
136135
136+
- name: Run pgx-tests with cshim enabled
137+
run: |
138+
cargo test \
139+
--features "pg$PG_VER cshim" \
140+
--package pgx-tests
141+
142+
- name: Run pgx-tests with cshim disabled
143+
run: |
144+
cargo test \
145+
--features "pg$PG_VER" \
146+
--package pgx-tests
147+
137148
- name: Run aggregate example tests
138149
run: cargo test --package aggregate --features "pg$PG_VER" --no-default-features
139150

.github/workflows/will-it-blend-develop.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,42 @@ jobs:
4646
run: |
4747
export PG_MAJOR_VER=$(echo ${{ matrix.pg_version}} | cut -c3-)
4848
echo "PG_MAJOR_VER=$PG_MAJOR_VER" >> $GITHUB_ENV
49+
echo "CARGO_LOCKED_OPTION=--locked" >> $GITHUB_ENV
4950
5051
- name: Run PGX tests for Postgres ${{ matrix.pg_version }} using container ${{ matrix.container }}
5152
shell: bash
5253
run: ./.github/docker/run-docker.sh "$PG_MAJOR_VER" ${{ matrix.container }}
54+
55+
cargo_unlocked_tests:
56+
name: Cargo unlocked tests
57+
runs-on: ubuntu-latest
58+
strategy:
59+
fail-fast: false # We want all of them to run, even if one fails
60+
matrix:
61+
pg_version: ["pg11", "pg12", "pg13", "pg14", "pg15"]
62+
container: ["debian:bullseye"]
63+
steps:
64+
# See above for logic details here
65+
- name: Set up correct branch environment variable
66+
run: |
67+
if [ $GITHUB_EVENT_NAME == "schedule" ]; then
68+
echo "Running via schedule, so using branch develop"
69+
echo "NIGHTLY_BUILD_REF=develop" >> $GITHUB_ENV
70+
else
71+
echo "Not running via schedule, so using branch $GITHUB_HEAD_REF"
72+
echo "NIGHTLY_BUILD_REF=$GITHUB_HEAD_REF" >> $GITHUB_ENV
73+
fi
74+
75+
- uses: actions/checkout@v3
76+
with:
77+
ref: ${{ env.NIGHTLY_BUILD_REF }}
78+
79+
- name: Set up environment variables
80+
run: |
81+
export PG_MAJOR_VER=$(echo ${{ matrix.pg_version}} | cut -c3-)
82+
echo "PG_MAJOR_VER=$PG_MAJOR_VER" >> $GITHUB_ENV
83+
echo "CARGO_LOCKED_OPTION=" >> $GITHUB_ENV
84+
85+
- name: Run PGX tests for Postgres ${{ matrix.pg_version }} using container ${{ matrix.container }}
86+
shell: bash
87+
run: ./.github/docker/run-docker.sh "$PG_MAJOR_VER" ${{ matrix.container }}

.github/workflows/will-it-blend.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ target/
99
cmake*/
1010
.direnv
1111
pgx-examples/*/target
12+
/bin

0 commit comments

Comments
 (0)