Skip to content

Commit

Permalink
update scripts/ci
Browse files Browse the repository at this point in the history
  • Loading branch information
bitner committed Oct 30, 2024
1 parent b8b2e4b commit 6de6af3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 22 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/civ2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,14 @@ jobs:
- name: Install pypgstac
run: |
cd /home/runner/work/pgstac/pgstac/src/pypgstac
uv venv
. .venv/bin/activate
uv pip install psycopg[binary] psycopg-pool
uv sync --frozen --no-install-project --extra test --extra dev
uv pip install --system psycopg[binary] psycopg-pool
uv pip compile pyproject.toml -o /tmp/requirements.txt --extra test --extra dev
uv pip install requirements.txt
uv pip install --offline --find-links /tmp/wheels pypgstac
- name: Run tests
run: |
cd /home/runner/work/pgstac/pgstac/src/pypgstac
. .venv/bin/activate
export PATH=$SCRIPTS:$PWD/.venv/bin:$PATH
export PGHOST=localhost
echo $PATH
$SCRIPTS/test
1 change: 1 addition & 0 deletions docker/pypgstac/bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ then
MIGRATIONS=1
fi


[ $FORMATTING -eq 1 ] && test_formatting
[ $SETUPDB -eq 1 ] && setuptestdb
[ $PGTAP -eq 1 ] && test_pgtap
Expand Down
1 change: 0 additions & 1 deletion scripts/nuke
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
docker compose down -v --remove-orphans

fi
fi
25 changes: 12 additions & 13 deletions scripts/runinpypgstac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR/..

# set -e
set -e

if [[ "${CI}" ]]; then
set -x
Expand All @@ -16,7 +16,7 @@ exit 1
}

[ "$#" -eq 0 ] && usage

echo "ARGS: $@"
ARGS=($@)
CONTAINER_ARGS=()
VOLUMES=""
Expand All @@ -30,19 +30,13 @@ do
elif [[ $ARG == "--nuke" ]]; then
NUKE=1
elif [[ $ARG == "--mountmigrations" ]]; then
VOLUMES="$VOLUMES \
-v $PWD/src/pgstac/migrations:/src/pgstac/migrations \
-v $PWD/src/pgstac/sql/999_version.sql:/src/pgstac/sql/999_version.sql \
-v $PWD/src/pgstac/pgstac.sql:/src/pgstac/pgstac.sql \
-v $PWD/src/pypgstac/python/pypgstac/version.py:/src/pypgstac/python/pypgstac/version.py \
-v $PWD/src/pypgstac/pyproject.toml:/src/pypgstac/pyproject.toml"
VOLUMES="$VOLUMES -v $PWD/src/pgstac/migrations:/src/pgstac/migrations -v $PWD/src/pgstac/sql/999_version.sql:/src/pgstac/sql/999_version.sql -v $PWD/src/pgstac/pgstac.sql:/src/pgstac/pgstac.sql -v $PWD/src/pypgstac/python/pypgstac/version.py:/src/pypgstac/python/pypgstac/version.py -v $PWD/src/pypgstac/pyproject.toml:/src/pypgstac/pyproject.toml"
elif [[ $ARG == "--mountpy" ]]; then
VOLUMES="$VOLUMES \
-v $PWD/src/pypgstac/python/pypgstac:/src/pypgstac/python/pypgstac \
-v $PWD/src/pypgstac/tests:/src/pypgstac/tests"
VOLUMES="$VOLUMES -v $PWD/src/pypgstac/python/pypgstac:/src/pypgstac/python/pypgstac -v $PWD/src/pypgstac/tests:/src/pypgstac/tests"
elif [[ $ARG == "--localuser" ]]; then
USER="--user $(id -u):$(id -g)"
USERID="--user $(id -u):$(id -g)"
else
echo "Adding $ARG to args"
CONTAINER_ARGS+=($ARG)
fi
done
Expand All @@ -60,7 +54,12 @@ fi
# Check if pgstac is already running
PGSTAC_RUNNING=$(docker compose ps pgstac --status running -q)

docker compose run --rm $VOLUMES $USER pypgstac "${CONTAINER_ARGS[@]}"
echo "Running pypgstac"
echo "VOLUMES: $VOLUMES"
echo "USER: $USERID"
echo "CARGS: ${CONTAINER_ARGS[@]}"

docker compose run --rm $VOLUMES $USERID pypgstac "${CONTAINER_ARGS[@]}"

JOBEXITCODE=$?
[[ $PGSTAC_RUNNING == "" ]] && docker compose down --remove-orphans
Expand Down
2 changes: 1 addition & 1 deletion scripts/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
$SCRIPT_DIR/runinpypgstac --build test "$@"
$SCRIPT_DIR/runinpypgstac test "$@"

0 comments on commit 6de6af3

Please sign in to comment.