Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

rust 1.40.0 #23

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
15 changes: 12 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
# Ensure rustfmt is installed and setup problem matcher
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.40.0
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
Expand All @@ -25,12 +26,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: ./tests/run.sh
with:
toolchain: 1.40.0
- run: cargo build
- run: ./tests/run.sh --keep-database --diff
env:
PGQL_DB_HOST: 127.0.0.1
PGQL_DB_HOST: localhost
PGQL_DB_USER: postgres
PGQL_DB_PASSWORD: postgres
PGQL_DB_NAME: travis_ci_test
PGQL_DB_NAME: postgres
services:
postgres:
image: postgres:12
Expand All @@ -43,11 +47,16 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

clippy:
name: cargo clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.40.0
components: clippy
- run: cargo clippy
20 changes: 17 additions & 3 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ filter=""
no_confirmation=""
quiet=""
keep_database=""
create_schema=1

total=0;
failures=();
Expand Down Expand Up @@ -194,6 +195,7 @@ read_args() {
echo " -p, --patch Patch expected output files to match actual output when different"
echo " -n, --no-confirmation Don’t ask for confirmation before updated expected output files"
echo " -k, --keep-database Don’t reset the database at start"
echo " --no-schema Don’t create the schema at start"
echo " -f, --filter FILTER Only execute test matching FILTER"
exit 0
;;
Expand All @@ -217,6 +219,10 @@ read_args() {
keep_database=1
shift
;;
--no-schema)
create_schema=""
shift
;;
-q|--quiet)
quiet=1
shift
Expand All @@ -238,10 +244,18 @@ read_args() {
}

reset_database () {
export PGPASSWORD="$PGQL_DB_PASSWORD"
psql="psql -h $PGQL_DB_HOST -U $PGQL_DB_USER -w -v ON_ERROR_STOP=1 -q"

if [ -z "$keep_database" ]; then
psql="PGPASSWORD=\"$PGQL_DB_PASSWORD\" psql -h \"$PGQL_DB_HOST\" -U \"$PGQL_DB_USER\" -w -v ON_ERROR_STOP=1 -q"
echo "drop database if exists $PGQL_DB_NAME; create database $PGQL_DB_NAME" | eval "$psql"
cat ./schema.sql | envsubst | eval "$psql" -d "$PGQL_DB_NAME"
echo Creating Database
echo "drop database if exists $PGQL_DB_NAME; create database $PGQL_DB_NAME" | $psql
fi

if [ ! -z "$create_schema" ]; then
echo Creating DB schema
cat ./schema.sql | envsubst
cat ./schema.sql | envsubst | $psql -d "$PGQL_DB_NAME"
fi
}

Expand Down
Loading