Skip to content

Commit

Permalink
Configure CI (no. 150)
Browse files Browse the repository at this point in the history
  • Loading branch information
cafour committed Jun 11, 2021
1 parent f6473a3 commit 0c155d8
Showing 1 changed file with 44 additions and 11 deletions.
55 changes: 44 additions & 11 deletions ci/linux/run.sh
Expand Up @@ -7,7 +7,7 @@
PROGRAM='run.sh'
SHORTOPTS="h"
LONGOPTS="help,\
root:,config:,\
root:,config:,samples-profile:,samples-port:,samples-port-api:,\
all,clean,npm-build,sln-restore,sln-build,unit-tests,js-tests,ui-tests,\
no-all,no-clean,no-npm-build,no-sln-restore,no-sln-build,no-unit-tests,no-js-tests,no-ui-tests"
TEMP=$(getopt -o "$SHORTOPS" -l "$LONGOPTS" -n "$PROGRAM" -- "$@")
Expand All @@ -33,8 +33,11 @@ Usage: $PROGRAM [options]
Options:
-h, --help Show this help.
--root ROOT Path to the repo root (default = \$DOTVVM_ROOT:-\$PWD)
--config CONFIG The build configuration (default = \$BUILD_CONFIGURATION:-Release)
--root ROOT Path to the repo root (default = \$DOTVVM_ROOT:-\$PWD).
--config CONFIG The build configuration (default = \$BUILD_CONFIGURATION:-Release).
--samples-profile (default = \$SAMPLES_PROFILE:-seleniumconfig.aspnetcorelatest.chrome.json).
--samples-port (default = 16019).
--samples-port-api (default = 5001).
--[no-]all Enable or disable all phases.
--[no-]clean Clean the with 'git clean' first (default = 0).
--[no-]npm-build Build the JS part of the Framework (default = 1).
Expand Down Expand Up @@ -70,6 +73,21 @@ EOF
shift 2
continue
;;
'--samples-profile')
SAMPLES_PROFILE="$2"
shift 2
continue
;;
'--samples-port')
SAMPLES_PORT="$2"
shift 2
continue
;;
'--samples-port-api')
SAMPLES_PORT_API="$2"
shift 2
continue
;;
'--')
shift
break
Expand Down Expand Up @@ -113,17 +131,23 @@ ROOT=${DOTVVM_ROOT:-$(pwd)}
# override DOTVVM_ROOT in case this is a local build
export DOTVVM_ROOT=$ROOT

CONFIGURATION=${BUILD_CONFIGURATION:-Release}
DISPLAY=${DISPLAY:-":42"}
SLN=$ROOT/ci/linux/Linux.sln
TEST_RESULTS_DIR=$ROOT/artifacts/test
CONFIGURATION="${BUILD_CONFIGURATION:-Release}"
DISPLAY="${DISPLAY:-":42"}"
SLN="$ROOT/ci/linux/Linux.sln"
TEST_RESULTS_DIR="$ROOT/artifacts/test"
SAMPLES_PROFILE="${SAMPLES_PROFILE:-seleniumconfig.aspnetcorelatest.chrome.json}"
SAMPLES_PORT="${SAMPLES_PORT:-16019}"
SAMPLES_PORT_API="${SAMPLES_PORT_API:-5001}"

tput sgr0
echo "ROOT=$ROOT"
echo "SLN=$SLN"
echo "CONFIGURATION=$CONFIGURATION"
echo "DISPLAY=$DISPLAY"
echo "TEST_RESULTS_DIR=$TEST_RESULTS_DIR"
echo "SAMPLES_PROFILE=$SAMPLES_PROFILE"
echo "SAMPLES_PORT=$SAMPLES_PORT"
echo "SAMPLES_PORT_API=$SAMPLES_PORT_API"

# ================
# helper functions
Expand Down Expand Up @@ -216,20 +240,29 @@ if [ $UI_TESTS -eq 1 ]; then
dotnet run --project "$ROOT/src/DotVVM.Samples.BasicSamples.Api.AspNetCoreLatest" \
--no-build \
--configuration "$CONFIGURATION" \
--urls http://localhost:5001/ >/dev/null &
--urls "http://localhost:${SAMPLES_PORT_API}/" >/dev/null &
SAMPLES_API_PID=$!

dotnet run --project "$ROOT/src/DotVVM.Samples.BasicSamples.AspNetCoreLatest" \
--no-build \
--configuration "$CONFIGURATION" \
--urls http://localhost:16018/ >/dev/null &
--urls "http://localhost:${SAMPLES_PORT}/" >/dev/null &
SAMPLES_PID=$!

SAMPLES_DIR="$ROOT/src/DotVVM.Samples.Tests"
PROFILE_PATH="$SAMPLES_DIR/Profiles/$SELENIUM_CONFIG"

if [ ! -f "$PROFILE_PATH" ]; then
echo >&2 "Profile '$PROFILE_PATH' doesn't exist."
fi
cp -f "$PROFILE_PATH" "$SAMPLES_DIR/seleniumconfig.json"

run_named_command "UI tests" \
"dotnet test \"$ROOT/src/DotVVM.Samples.Tests\" \
"dotnet test \"\" \
--no-build \
--configuration $CONFIGURATION \
--logger trx \
--results-directory \"$TEST_RESULTS_DIR\""

kill $XVFB_PID $SAMPLES_PID 2>/dev/null
kill $XVFB_PID $SAMPLES_PID $SAMPLES_API_PID 2>/dev/null
fi

0 comments on commit 0c155d8

Please sign in to comment.