-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a ci/run.sh script per example. Eventually we might want to provide that functionality via the zig build system as extra tasks. But there are a few things that I would like to change in the build helpers that we have before adding test runners to it. The main ci/run.sh script will build the examples in parallel now.
- Loading branch information
Showing
4 changed files
with
233 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env bash | ||
|
||
#set -x | ||
set -o pipefail | ||
|
||
EXTENSION_NAME=char_count_zig | ||
|
||
build() { | ||
echo "Build extension $EXTENSION_NAME" | ||
zig build -freference-trace -p "$PG_HOME" || return 1 | ||
} | ||
|
||
create_extension() { | ||
echo "Create extension $EXTENSION_NAME" | ||
psql -U postgres -c "CREATE EXTENSION IF NOT EXISTS $EXTENSION_NAME" | ||
} | ||
|
||
extension_drop() { | ||
echo "Drop extension $EXTENSION_NAME" | ||
psql -U postgres -c "DROP EXTENSION IF EXISTS $EXTENSION_NAME" | ||
} | ||
|
||
regression_tests() { | ||
echo "Run regression tests: $EXTENSION_NAME" | ||
zig build pg_regress --verbose || return 1 | ||
} | ||
|
||
unit_tests() { | ||
echo "Run unit tests: $EXTENSION_NAME" | ||
zig build -freference-trace -p "$PG_HOME" unit || return 1 | ||
} | ||
|
||
all() { | ||
build && create_extension && unit_tests && regression_tests && extension_drop | ||
} | ||
|
||
# optional command. Use all if not specified | ||
command=${1:-all} | ||
|
||
#shellcheck disable=SC1007 | ||
HELP= <<EOF | ||
Usage: $0 [command] | ||
commands (default 'all'): | ||
all - build nand run tests | ||
build - build and install extension | ||
create_extension - create extension | ||
extension_drop - drop extension | ||
regression_tests - run regression tests | ||
unit_tests - run unit tests | ||
help - show this help message | ||
EOF | ||
|
||
case $command in | ||
all) all ;; | ||
build) build ;; | ||
create_extension) create_extension ;; | ||
extension_drop) extension_drop ;; | ||
regression_tests) regression_tests ;; | ||
unit_tests) unit_tests ;; | ||
help) echo "$HELP" ;; | ||
*) echo "$HELP" ;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
#set -x | ||
set -o pipefail | ||
|
||
EXTENSION_NAME=pgaudit_zig | ||
|
||
build() { | ||
echo "Build extension $EXTENSION_NAME" | ||
zig build -freference-trace -p "$PG_HOME" || return 1 | ||
} | ||
|
||
create_extension() { | ||
echo "Create extension $EXTENSION_NAME" | ||
psql -U postgres -c "CREATE EXTENSION IF NOT EXISTS $EXTENSION_NAME" | ||
} | ||
|
||
extension_drop() { | ||
echo "Drop extension $EXTENSION_NAME" | ||
psql -U postgres -c "DROP EXTENSION IF EXISTS $EXTENSION_NAME" | ||
} | ||
|
||
unit_tests() { | ||
echo "Run unit tests: $EXTENSION_NAME" | ||
zig build -freference-trace -p "$PG_HOME" unit || return 1 | ||
} | ||
|
||
all() { | ||
build && create_extension && unit_tests && extension_drop | ||
} | ||
|
||
# optional command. Use all if not specified | ||
command=${1:-all} | ||
|
||
#shellcheck disable=SC1007 | ||
HELP= <<EOF | ||
Usage: $0 [command] | ||
commands (default 'all'): | ||
all - build nand run tests | ||
build - build and install extension | ||
create_extension - create extension | ||
extension_drop - drop extension | ||
unit_tests - run unit tests | ||
help - show this help message | ||
EOF | ||
|
||
case $command in | ||
all) all ;; | ||
build) build ;; | ||
create_extension) create_extension ;; | ||
extension_drop) extension_drop ;; | ||
unit_tests) unit_tests ;; | ||
help) echo "$HELP" ;; | ||
*) echo "$HELP" ;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env bash | ||
|
||
#set -x | ||
set -o pipefail | ||
|
||
EXTENSION_NAME=spi_sql | ||
|
||
build() { | ||
echo "Build extension $EXTENSION_NAME" | ||
zig build -freference-trace -p "$PG_HOME" || return 1 | ||
} | ||
|
||
create_extension() { | ||
echo "Create extension $EXTENSION_NAME" | ||
psql -U postgres -c "CREATE EXTENSION IF NOT EXISTS $EXTENSION_NAME" | ||
} | ||
|
||
extension_drop() { | ||
echo "Drop extension $EXTENSION_NAME" | ||
psql -U postgres -c "DROP EXTENSION IF EXISTS $EXTENSION_NAME" | ||
} | ||
|
||
regression_tests() { | ||
echo "Run regression tests: $EXTENSION_NAME" | ||
zig build pg_regress --verbose || return 1 | ||
} | ||
|
||
all() { | ||
build && create_extension && regression_tests && extension_drop | ||
} | ||
|
||
# optional command. Use all if not specified | ||
command=${1:-all} | ||
|
||
#shellcheck disable=SC1007 | ||
HELP= <<EOF | ||
Usage: $0 [command] | ||
commands (default 'all'): | ||
all - build nand run tests | ||
build - build and install extension | ||
create_extension - create extension | ||
extension_drop - drop extension | ||
regression_tests - run regression tests | ||
help - show this help message | ||
EOF | ||
|
||
case $command in | ||
all) all ;; | ||
build) build ;; | ||
create_extension) create_extension ;; | ||
extension_drop) extension_drop ;; | ||
regression_tests) regression_tests ;; | ||
unit_tests) unit_tests ;; | ||
help) echo "$HELP" ;; | ||
*) echo "$HELP" ;; | ||
esac |