Skip to content

Commit

Permalink
Add -profile option to build script
Browse files Browse the repository at this point in the history
  • Loading branch information
syvb committed Oct 24, 2022
1 parent e018c7b commit 20a44b0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tools/build
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

set -ex

profile=dev

print() {
printf '%s\n' "$*"
}
Expand Down Expand Up @@ -41,6 +39,9 @@ require_cargo_pgx_old() {
[ -n "$cargo_pgx_old" ] || die 'specify path to cargo-pgx (0.2-0.3 series)'
}

find_profile() {
[ -n "$profile" ] || profile=dev
}

[ $# -ge 1 ] || usage

Expand Down Expand Up @@ -84,34 +85,39 @@ while [ $# -gt 0 ]; do
;;

clippy)
find_profile
$nop cargo fetch
# We need to pick a postgres version to clippy the timescaledb_toolkit crate, but it doesn't matter which one.
$nop cargo clippy --workspace --features 'pg14 pg_test' -- -D warnings
$nop cargo clippy --profile $profile --workspace --features 'pg14 pg_test' -- -D warnings
;;

test-crates)
# Should find no dependency crates to fetch. If it finds any, we need to update the cache key.
find_profile
$nop cargo fetch
$nop cargo test --profile $profile --workspace --exclude timescaledb_toolkit
;;

test-extension)
cd extension
find_profile
require_pg_version
$nop cargo fetch
$nop cargo test --profile $profile --features "$pg pg_test" --no-default-features
;;

install)
find_profile
require_pg_version
find_pg_config
(cd extension && PROFILE=$profile $nop cargo pgx install -c "$pg_config")
(cd extension && $nop cargo pgx install --profile $profile -c "$pg_config")
$nop cargo run --manifest-path tools/post-install/Cargo.toml "$pg_config"
;;

# Reruns the tests test-extension does if they're left installed.
# TODO Remove this and testrunner.
test-post-install)
find_profile
require_pg_version
find_pg_config
$nop cargo pgx stop $pg
Expand All @@ -120,6 +126,7 @@ while [ $# -gt 0 ]; do
;;

test-doc)
find_profile
require_pg_version
$nop cargo pgx start $pg
$nop cargo run --profile $profile -p sql-doctester -- \
Expand All @@ -131,6 +138,7 @@ while [ $# -gt 0 ]; do
;;

test-updates)
find_profile
require_pg_version
find_pg_config
require_cargo_pgx
Expand Down

0 comments on commit 20a44b0

Please sign in to comment.