Skip to content

Commit 89f677a

Browse files
Test that pgrx can build after publishing (pgcentralfoundation#1796)
Test that pgrx will always build after we publish it. It should never again take an excessive amount of time to release pgrx, because we will always be confident we are ready to release. This does not finish making the release "turnkey", but it does take care of every obstacle to such. Note that there is a technicality: we are "only" testing that our _package_ builds. We are not actually pulling a published-to-cargo release and testing it. We are not running the `cargo publish --dry-run` command, either, because there is no `cargo publish --workspace`. Instead, we are packaging the workspace and rebuilding *that package*. This unfortunately demands that we factor out all the packages in the workspace that are not going to be published. Other details of the refactoring are informed by these oddities: - `package.publish = false` doesn't play well with the extensions to `cargo package --workspace`: rust-lang/cargo#14356 - `workspace.exclude = []` does not properly support globs: rust-lang/cargo#6009 - We *need* to reuse the same `CARGO_TARGET_DIR` for building and testing our many examples or we run out of storage space on the runners.
1 parent 7e1e6d7 commit 89f677a

File tree

10 files changed

+390
-367
lines changed

10 files changed

+390
-367
lines changed

.cargo/config.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
[alias]
2+
b = "build --features"
3+
c = "check --features"
4+
t = "test --features"
5+
r = "run --features"
6+
17
[target.'cfg(target_os="macos")']
28
# Postgres symbols won't be available until runtime
39
rustflags = ["-Clink-arg=-Wl,-undefined,dynamic_lookup"]

.github/workflows/tests.yml

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env:
1515
CARGO_INCREMENTAL: "false"
1616
SCCACHE_MAX_FRAME_LENGTH: 100000000
1717
# CARGO_LOG: cargo::core::compiler::fingerprint=info # Uncomment this to output compiler fingerprint info
18+
TOOL_DIR: ./tools
1819

1920
jobs:
2021
lintck:
@@ -43,7 +44,7 @@ jobs:
4344
mkdir -p /home/runner/.cache/sccache
4445
echo ""
4546
46-
./ci/rustup.sh
47+
"$TOOL_DIR"/rustup.sh
4748
4849
# https://stackoverflow.com/questions/57968497/how-do-i-set-an-env-var-with-a-bash-expression-in-github-actions/57969570#57969570
4950
@@ -77,7 +78,7 @@ jobs:
7778
run: cargo fmt --all -- --check
7879

7980
- name: Run license check
80-
run: cargo install cargo-deny --locked && ./ci/license-check.sh
81+
run: cargo install cargo-deny --locked && "$TOOL_DIR"/license-check.sh
8182

8283
# We can't lint most crates because they require "cargo pgrx init" to build
8384
- name: Clippy -Dwarnings sql-entity-graph
@@ -149,7 +150,7 @@ jobs:
149150
zlib1g-dev
150151
echo ""
151152
152-
./ci/rustup.sh
153+
"$TOOL_DIR"/rustup.sh
153154
154155
echo "----- Set up cross compilation -----"
155156
sudo apt-get install -y --fix-missing crossbuild-essential-arm64
@@ -250,88 +251,88 @@ jobs:
250251
251252
252253
- name: Run aggregate example tests
253-
run: cargo test --package aggregate --features "pg$PG_VER" --no-default-features
254+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/aggregate/Cargo.toml --features "pg$PG_VER" --no-default-features
254255

255256
- name: Run arrays example tests
256-
run: cargo test --package arrays --features "pg$PG_VER" --no-default-features
257+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/arrays/Cargo.toml --features "pg$PG_VER" --no-default-features
257258

258259
- name: Run bad_ideas example tests
259-
run: cargo test --package bad_ideas --features "pg$PG_VER" --no-default-features
260+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/bad_ideas/Cargo.toml --features "pg$PG_VER" --no-default-features
260261

261262
- name: Run bgworker example tests
262-
run: cargo test --package bgworker --features "pg$PG_VER" --no-default-features
263+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/bgworker/Cargo.toml --features "pg$PG_VER" --no-default-features
263264

264265
- name: Run bytea example tests
265-
run: cargo test --package bytea --features "pg$PG_VER" --no-default-features
266+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/bytea/Cargo.toml --features "pg$PG_VER" --no-default-features
266267

267268
- name: Run composite_type example tests
268-
run: cargo test --package composite_type --features "pg$PG_VER" --no-default-features
269+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/composite_type/Cargo.toml --features "pg$PG_VER" --no-default-features
269270

270271
- name: Run custom_libname example tests
271-
run: cargo test --package custom_libname --features "pg$PG_VER" --no-default-features
272+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/custom_libname/Cargo.toml --features "pg$PG_VER" --no-default-features
272273

273274
- name: Run custom_types example tests
274-
run: cargo test --package custom_types --features "pg$PG_VER" --no-default-features
275+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/custom_types/Cargo.toml --features "pg$PG_VER" --no-default-features
275276

276277
- name: Run custom_types without schema generation example tests
277-
run: cargo test --package custom_types --features "pg$PG_VER no-schema-generation" --no-default-features
278+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/custom_types/Cargo.toml --features "pg$PG_VER no-schema-generation" --no-default-features
278279

279280
- name: Run custom_sql example tests
280-
run: cargo test --package custom_sql --features "pg$PG_VER" --no-default-features
281+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/custom_sql/Cargo.toml --features "pg$PG_VER" --no-default-features
281282

282283
- name: Run datetime example tests
283-
run: cargo test --package datetime --features "pg$PG_VER" --no-default-features
284+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/datetime/Cargo.toml --features "pg$PG_VER" --no-default-features
284285

285286
- name: Run errors example tests
286-
run: cargo test --package errors --features "pg$PG_VER" --no-default-features
287+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/errors/Cargo.toml --features "pg$PG_VER" --no-default-features
287288

288289
- name: Run nostd example tests
289-
run: cargo test --package nostd --features "pg$PG_VER" --no-default-features
290+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/nostd/Cargo.toml --features "pg$PG_VER" --no-default-features
290291

291292
- name: Run numeric example tests
292-
run: cargo test --package numeric --features "pg$PG_VER" --no-default-features
293+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/numeric/Cargo.toml --features "pg$PG_VER" --no-default-features
293294

294295
- name: Run pgtrybuilder example tests
295-
run: cargo test --package pgtrybuilder --features "pg$PG_VER" --no-default-features
296+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/pgtrybuilder/Cargo.toml --features "pg$PG_VER" --no-default-features
296297

297298
- name: Run operators example tests
298-
run: cargo test --package operators --features "pg$PG_VER" --no-default-features
299+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/operators/Cargo.toml --features "pg$PG_VER" --no-default-features
299300

300301
- name: Run range example tests
301-
run: cargo test --package range --features "pg$PG_VER" --no-default-features
302+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/range/Cargo.toml --features "pg$PG_VER" --no-default-features
302303

303304
- name: Run schemas example tests
304-
run: cargo test --package schemas --features "pg$PG_VER" --no-default-features
305+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/schemas/Cargo.toml --features "pg$PG_VER" --no-default-features
305306

306307
- name: Run shmem example tests
307-
run: cargo test --package shmem --features "pg$PG_VER" --no-default-features
308+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/shmem/Cargo.toml --features "pg$PG_VER" --no-default-features
308309

309310
- name: Run spi example tests
310-
run: cargo test --package spi --features "pg$PG_VER" --no-default-features
311+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/spi/Cargo.toml --features "pg$PG_VER" --no-default-features
311312

312313
- name: Run spi_srf example tests
313-
run: cargo test --package spi_srf --features "pg$PG_VER" --no-default-features
314+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/spi_srf/Cargo.toml --features "pg$PG_VER" --no-default-features
314315

315316
- name: Run srf example tests
316-
run: cargo test --package srf --features "pg$PG_VER" --no-default-features
317+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/srf/Cargo.toml --features "pg$PG_VER" --no-default-features
317318

318319
- name: Run strings example tests
319-
run: cargo test --package strings --features "pg$PG_VER" --no-default-features
320+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/strings/Cargo.toml --features "pg$PG_VER" --no-default-features
320321

321322
- name: Run triggers example tests
322-
run: cargo test --package triggers --features "pg$PG_VER" --no-default-features
323+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/triggers/Cargo.toml --features "pg$PG_VER" --no-default-features
323324

324325
- name: Run versioned_custom_libname_so example tests
325-
run: cargo test --package versioned_custom_libname_so --features "pg$PG_VER" --no-default-features
326+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/versioned_custom_libname_so/Cargo.toml --features "pg$PG_VER" --no-default-features
326327

327328
- name: Run versioned_so example tests
328-
run: cargo test --package versioned_so --features "pg$PG_VER" --no-default-features
329+
run: CARGO_TARGET_DIR="$(pwd)/target" cargo test --manifest-path=pgrx-examples/versioned_so/Cargo.toml --features "pg$PG_VER" --no-default-features
329330

330331
- name: Run `cargo pgrx schema` against the versioned_custom_libname_so example
331-
run: cargo pgrx schema pg$PG_VER --package versioned_custom_libname_so
332+
run: cd pgrx-examples/versioned_custom_libname_so && cargo pgrx schema pg$PG_VER
332333

333334
- name: Test that version bumps work
334-
run: ./update-versions.sh 0.0.999-rc.999
335+
run: ./update-versions.sh 0.0.999-rc.999 && cargo +nightly package --workspace -Zpackage-workspace --allow-dirty --features "pg$PG_VER"
335336

336337
# Attempt to make the cache payload slightly smaller.
337338
- name: Clean up built PGRX files
@@ -401,7 +402,7 @@ jobs:
401402
zlib1g-dev
402403
echo ""
403404
404-
./ci/rustup.sh
405+
"$TOOL_DIR"/rustup.sh
405406
406407
echo "----- Outputting env -----"
407408
env
@@ -528,7 +529,7 @@ jobs:
528529
# ls -lath `$(which pg_config) --pkglibdir` `$(which pg_config) --sharedir`/extension
529530
echo ""
530531
531-
./ci/rustup.sh
532+
"$TOOL_DIR"/rustup.sh
532533
533534
echo "----- Outputting env -----"
534535
env

0 commit comments

Comments
 (0)