Skip to content

Commit

Permalink
🚨Rename to pgrx 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
eeeebbbbrrrr authored Apr 17, 2023
1 parent ac392df commit 8726d4f
Show file tree
Hide file tree
Showing 440 changed files with 35,924 additions and 35,917 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ target/
*.a
cmake*/
.direnv
pgx-examples/*/target
pgrx-examples/*/target
14 changes: 7 additions & 7 deletions .github/docker/Dockerfile.alpine:3.16
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Example of how to build this container (ran from pgx checkout directory):
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.alpine\:3.16 -t pgx-alpine .
# Example of how to build this container (ran from pgrx checkout directory):
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.alpine\:3.16 -t pgrx-alpine .
#
# Example of how to run this container with tests after building the image:
# docker run pgx-alpine cargo test --no-default-features --features pg14 --locked
# docker run pgrx-alpine cargo test --no-default-features --features pg14 --locked
#
# Note that "PG_MAJOR_VER" build arg in the build step must match the
# "--features pgXX" in the run step
Expand Down Expand Up @@ -34,7 +34,7 @@ RUN chmod a+rwx `$(which pg_config) --pkglibdir` \
`$(which pg_config) --sharedir`/extension \
/var/run/postgresql/

# Running pgx and tests require a non-root user
# Running pgrx and tests require a non-root user
RUN adduser -s /bin/bash -D rust
WORKDIR /checkout
RUN chown -R rust:rust /checkout
Expand All @@ -54,12 +54,12 @@ ENV PATH="/home/rust/.cargo/bin:${PATH}"
ARG CARGO_LOCKED_OPTION='--locked'
ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION}

# Install cargo-pgx from source copied into this container
RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION
# Install cargo-pgrx from source copied into this container
RUN echo "Running cargo install --path cargo-pgrx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgrx/ $CARGO_LOCKED_OPTION

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

CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER} cshim", "${CARGO_LOCKED_OPTION}"]
20 changes: 10 additions & 10 deletions .github/docker/Dockerfile.amazon:2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Example of how to build this container (ran from pgx checkout directory):
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.amazon\:2 -t pgx-amazonlinux2 .
# Example of how to build this container (ran from pgrx checkout directory):
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.amazon\:2 -t pgrx-amazonlinux2 .
#
# Example of how to run this container with tests after building the image:
# docker run pgx-amazonlinux2 cargo test --no-default-features --features pg14 --locked
# docker run pgrx-amazonlinux2 cargo test --no-default-features --features pg14 --locked
#
# Note that "PG_MAJOR_VER" build arg in the build step must match the
# "--features pgXX" in the run step
Expand Down Expand Up @@ -63,7 +63,7 @@ RUN chmod a+rwx `$(which pg_config) --pkglibdir` \
`$(which pg_config) --sharedir`/extension \
/var/run/postgresql/

# Running pgx and tests require a non-root user
# Running pgrx and tests require a non-root user
RUN adduser -G wheel rust
WORKDIR /checkout
RUN chown -R rust:rust /checkout
Expand All @@ -82,11 +82,11 @@ ENV PATH="/home/rust/.cargo/bin:${PATH}"
ARG CARGO_LOCKED_OPTION='--locked'
ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION}

# Install cargo-pgx from source copied into this container
RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION
# Install cargo-pgrx from source copied into this container
RUN echo "Running cargo install --path cargo-pgrx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgrx/ $CARGO_LOCKED_OPTION

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

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

Expand Down Expand Up @@ -125,6 +125,6 @@ CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER}

# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
# ENV PATH="/home/rust/.cargo/bin:${PATH}"
# RUN cargo install --path cargo-pgx/
# RUN cargo pgx init --pg$PG_MAJOR_VER=$(which pg_config)
# RUN cargo install --path cargo-pgrx/
# RUN cargo pgrx init --pg$PG_MAJOR_VER=$(which pg_config)
# CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER}"]
16 changes: 8 additions & 8 deletions .github/docker/Dockerfile.debian:bullseye
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Example of how to build this container (ran from pgx checkout directory):
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.debian\:bullseye -t pgx-debian .
# Example of how to build this container (ran from pgrx checkout directory):
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.debian\:bullseye -t pgrx-debian .
#
# Example of how to run this container with tests after building the image:
# docker run pgx-debian cargo test --no-default-features --features pg14 --locked
# docker run pgrx-debian cargo test --no-default-features --features pg14 --locked
#
# Note that "PG_MAJOR_VER" build arg in the build step must match the
# "--features pgXX" in the run step
Expand Down Expand Up @@ -39,7 +39,7 @@ RUN chmod a+rwx `$(which pg_config) --pkglibdir` \
`$(which pg_config) --sharedir`/extension \
/var/run/postgresql/

# Running pgx and tests require a non-root user
# Running pgrx and tests require a non-root user
RUN useradd --create-home --shell /bin/bash rust
WORKDIR /checkout
RUN chown -R rust:rust /checkout
Expand All @@ -60,10 +60,10 @@ ENV PATH="/home/rust/.cargo/bin:${PATH}"
ARG CARGO_LOCKED_OPTION='--locked'
ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION}

# Install cargo-pgx from source copied into this container
RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION
# Install cargo-pgrx from source copied into this container
RUN echo "Running cargo install --path cargo-pgrx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgrx/ $CARGO_LOCKED_OPTION

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

CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER} cshim", "${CARGO_LOCKED_OPTION}"]
16 changes: 8 additions & 8 deletions .github/docker/Dockerfile.fedora:36
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Example of how to build this container (ran from pgx checkout directory):
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.fedora\:36 -t pgx-fedora .
# Example of how to build this container (ran from pgrx checkout directory):
# docker build --build-arg PG_MAJOR_VER=14 -f .github/docker/Dockerfile.fedora\:36 -t pgrx-fedora .
#
# Example of how to run this container with tests after building the image:
# docker run pgx-fedora cargo test --no-default-features --features pg14 --locked
# docker run pgrx-fedora cargo test --no-default-features --features pg14 --locked
#
# Note that "PG_MAJOR_VER" build arg in the build step must match the
# "--features pgXX" in the run step
Expand Down Expand Up @@ -31,7 +31,7 @@ RUN chmod a+rwx `/usr/pgsql-$PG_MAJOR_VER/bin/pg_config --pkglibdir` \
`/usr/pgsql-$PG_MAJOR_VER/bin/pg_config --sharedir`/extension \
/var/run/postgresql/

# Running pgx and tests require a non-root user
# Running pgrx and tests require a non-root user
RUN adduser -G wheel rust
WORKDIR /checkout
RUN chown -R rust:rust /checkout
Expand All @@ -51,10 +51,10 @@ ENV PATH="/home/rust/.cargo/bin:${PATH}"
ARG CARGO_LOCKED_OPTION='--locked'
ENV CARGO_LOCKED_OPTION=${CARGO_LOCKED_OPTION}

# Install cargo-pgx from source copied into this container
RUN echo "Running cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgx/ $CARGO_LOCKED_OPTION
# Install cargo-pgrx from source copied into this container
RUN echo "Running cargo install --path cargo-pgrx/ $CARGO_LOCKED_OPTION" && cargo install --path cargo-pgrx/ $CARGO_LOCKED_OPTION

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

CMD ["cargo", "test", "--no-default-features", "--features", "pg${PG_MAJOR_VER} cshim", "${CARGO_LOCKED_OPTION}"]
8 changes: 4 additions & 4 deletions .github/docker/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ set -x
PG_MAJOR_VER=$1
DOCKERFILE_ID=$2

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

docker build \
--build-arg PG_MAJOR_VER="$PG_MAJOR_VER" \
--build-arg CARGO_LOCKED_OPTION="$CARGO_LOCKED_OPTION" \
-t pgx \
-t pgrx \
-f ".github/docker/Dockerfile.$DOCKERFILE_ID" \
.

echo "Running PGX test suite using Postgres version $PG_MAJOR_VER in container $DOCKERFILE_ID with 'cshim'"
echo "Running PGRX test suite using Postgres version $PG_MAJOR_VER in container $DOCKERFILE_ID with 'cshim'"

docker run pgx \
docker run pgrx \
cargo test \
--no-default-features \
--features "pg$PG_MAJOR_VER cshim" \
Expand Down
94 changes: 47 additions & 47 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run PGX tests
name: Run PGRX tests

on:
push:
Expand All @@ -18,8 +18,8 @@ env:
# CARGO_LOG: cargo::core::compiler::fingerprint=info # Uncomment this to output compiler fingerprint info

jobs:
pgx_tests:
name: pgx-tests & examples
pgrx_tests:
name: pgrx-tests & examples
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'nogha')"
env:
Expand Down Expand Up @@ -111,55 +111,55 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
key: pgx-tests-cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}
key: pgrx-tests-cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}

- name: Cache sccache directory
uses: actions/cache@v3
continue-on-error: false
with:
path: /home/runner/.cache/sccache
key: pgx-tests-sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}
key: pgrx-tests-sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}

- name: Start sccache server
run: sccache --start-server

- name: Print sccache stats (before run)
run: sccache --show-stats

- name: Install cargo-pgx
run: cargo install --path cargo-pgx/ --debug --force
- name: Install cargo-pgrx
run: cargo install --path cargo-pgrx/ --debug --force

- name: Run 'cargo pgx init' against system-level ${{ matrix.version }}
run: cargo pgx init --pg$PG_VER /usr/lib/postgresql/$PG_VER/bin/pg_config
- name: Run 'cargo pgrx init' against system-level ${{ matrix.version }}
run: cargo pgrx init --pg$PG_VER /usr/lib/postgresql/$PG_VER/bin/pg_config

- name: Run base-level tests
run: |
cargo test \
--features "pg$PG_VER" \
--package cargo-pgx \
--package pgx \
--package pgx-macros \
--package pgx-pg-sys \
--package pgx-sql-entity-graph
--package cargo-pgrx \
--package pgrx \
--package pgrx-macros \
--package pgrx-pg-sys \
--package pgrx-sql-entity-graph
- name: Check that cross-compiled pgx-tests can build
- name: Check that cross-compiled pgrx-tests can build
run: |
cargo build --tests \
--features "pg$PG_VER" \
--package pgx-tests \
--package pgrx-tests \
--target aarch64-unknown-linux-gnu
- name: Run pgx-tests with cshim enabled
- name: Run pgrx-tests with cshim enabled
run: |
cargo test \
--features "pg$PG_VER cshim" \
--package pgx-tests
--package pgrx-tests
- name: Run pgx-tests with cshim disabled
- name: Run pgrx-tests with cshim disabled
run: |
cargo test \
--features "pg$PG_VER" \
--package pgx-tests
--package pgrx-tests
- name: Run aggregate example tests
run: cargo test --package aggregate --features "pg$PG_VER" --no-default-features
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
run: cargo test --package versioned_so --features "pg$PG_VER" --no-default-features

# Attempt to make the cache payload slightly smaller.
- name: Clean up built PGX files
- name: Clean up built PGRX files
run: |
cd target/debug/deps/
for built_file in $(find * -type f -executable -print | grep -v "\.so$"); do
Expand All @@ -248,8 +248,8 @@ jobs:
- name: Stop sccache server
run: sccache --stop-server || true

cargo_pgx_init:
name: cargo pgx init
cargo_pgrx_init:
name: cargo pgrx init
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'nogha')"
env:
Expand Down Expand Up @@ -325,14 +325,14 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
key: pgx-cargo_init_tests-cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}
key: pgrx-cargo_init_tests-cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}

- name: Cache sccache directory
uses: actions/cache@v3
continue-on-error: false
with:
path: /home/runner/.cache/sccache
key: pgx-cargo_init_tests-sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}
key: pgrx-cargo_init_tests-sccache-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}

- name: Start sccache server
run: sccache --start-server
Expand All @@ -343,28 +343,28 @@ jobs:
- name: Run rustfmt
run: cargo fmt --all -- --check

- name: Install cargo-pgx
run: cargo install --path cargo-pgx/ --debug --force
- name: Install cargo-pgrx
run: cargo install --path cargo-pgrx/ --debug --force

- name: Run 'cargo pgx init' for ${{ matrix.version }}
run: cargo pgx init --pg$PG_VER download
- name: Run 'cargo pgrx init' for ${{ matrix.version }}
run: cargo pgrx init --pg$PG_VER download

- name: create new sample extension
run: cd /tmp/ && cargo pgx new sample
run: cd /tmp/ && cargo pgrx new sample

# hack Cargo.toml to use this version of pgx from github
# hack Cargo.toml to use this version of pgrx from github
- name: hack Cargo.toml
run: |
echo "[patch.crates-io]" >> /tmp/sample/Cargo.toml
echo "pgx = { path = \"${GITHUB_WORKSPACE}/pgx\" }" >> /tmp/sample/Cargo.toml
echo "pgx-macros = { path = \"${GITHUB_WORKSPACE}/pgx-macros\" }" >> /tmp/sample/Cargo.toml
echo "pgx-tests = { path = \"${GITHUB_WORKSPACE}/pgx-tests\" }" >> /tmp/sample/Cargo.toml
echo "pgrx = { path = \"${GITHUB_WORKSPACE}/pgrx\" }" >> /tmp/sample/Cargo.toml
echo "pgrx-macros = { path = \"${GITHUB_WORKSPACE}/pgrx-macros\" }" >> /tmp/sample/Cargo.toml
echo "pgrx-tests = { path = \"${GITHUB_WORKSPACE}/pgrx-tests\" }" >> /tmp/sample/Cargo.toml
- name: show Cargo.toml
run: cat /tmp/sample/Cargo.toml

- name: Test sample for ${{ matrix.version }}
run: cd /tmp/sample && cargo pgx test pg$PG_VER
run: cd /tmp/sample && cargo pgrx test pg$PG_VER

- name: Stop sccache server
run: sccache --stop-server || true
Expand Down Expand Up @@ -416,7 +416,7 @@ jobs:
continue-on-error: false
with:
path: /Users/runner/Library/Caches/Mozilla.sccache
key: pgx-sccache-macos-11-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}
key: pgrx-sccache-macos-11-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}

- name: Start sccache server
run: sccache --start-server
Expand All @@ -430,27 +430,27 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
key: pgx-macos-11-tests-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}
key: pgrx-macos-11-tests-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml') }}

- name: Install cargo-pgx
run: cargo install --path cargo-pgx/ --debug --force
- name: Install cargo-pgrx
run: cargo install --path cargo-pgrx/ --debug --force

- name: Run 'cargo pgx init'
- name: Run 'cargo pgrx init'
run: |
set -x
cargo pgx init --pg$PG_VER $(which pg_config)
cargo pgrx init --pg$PG_VER $(which pg_config)
- name: Run base-level tests
run: |
set -x
cargo test \
--features "pg$PG_VER" --no-default-features \
--package cargo-pgx \
--package pgx \
--package pgx-macros \
--package pgx-pg-sys \
--package pgx-tests \
--package pgx-sql-entity-graph
--package cargo-pgrx \
--package pgrx \
--package pgrx-macros \
--package pgrx-pg-sys \
--package pgrx-tests \
--package pgrx-sql-entity-graph
- name: Stop sccache server
run: sccache --stop-server || true
Loading

0 comments on commit 8726d4f

Please sign in to comment.