Fix ./piston build, add test-with-cache option

This commit is contained in:
Omar Brikaa 2022-02-12 15:09:07 +02:00
parent a013613a59
commit b8e2af412e
1 changed files with 17 additions and 5 deletions

22
piston
View File

@ -39,22 +39,23 @@ case "$SUBCOMMAND" in
;; ;;
build) build)
build_base
runtime_set=all runtime_set=all
if [[ ! -z "$1" ]]; then if [[ ! -z "$1" ]]; then
runtime_Set=$1 runtime_set=$1
fi fi
# $1 contains a variant to build # $1 contains a variant to build
docker build \ docker build \
--build-arg RUNTIMESET=$1 \ --build-arg RUNTIMESET=$runtime_set \
-f "$SCRIPT_DIR"/Dockerfile.withset \ -f "$SCRIPT_DIR"/Dockerfile.withset \
-t "$IMAGE_NAME_DEV:$1-latest" \ -t "$IMAGE_NAME_DEV:$runtime_set-latest" \
. .
;; ;;
# dev commands # dev commands
scaffold) scaffold)
pushd "$SCRIPT_DIR"/runtimes > /dev/null pushd "$SCRIPT_DIR/runtimes" > /dev/null
./scaffold.sh $1 $2 ./scaffold.sh $1 $2
popd > /dev/null popd > /dev/null
;; ;;
@ -99,6 +100,17 @@ case "$SUBCOMMAND" in
;; ;;
test) test)
docker run \
--rm \
-it \
-e PISTON_FLAKE_PATH=/piston/src \
-v "$SCRIPT_DIR":/piston/src \
--name piston_test_runner \
"$IMAGE_NAME_DEV:$IMAGE_TAG" \
piston-test $1
;;
test-with-cache)
docker run \ docker run \
--rm \ --rm \
-it \ -it \
@ -107,7 +119,7 @@ case "$SUBCOMMAND" in
-v $DEV_VOLUME_NAME:/nix \ -v $DEV_VOLUME_NAME:/nix \
--name piston_test_runner \ --name piston_test_runner \
"$IMAGE_NAME_DEV:$IMAGE_TAG" \ "$IMAGE_NAME_DEV:$IMAGE_TAG" \
bash -c "/piston/src/api/src/bin/test.js $1" piston-test $1
;; ;;
*) *)