aboutsummaryrefslogtreecommitdiffstats
path: root/bin/build
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-01-03 14:02:54 -0600
committerJP Dillingham <jpdillingham@gmail.com>2021-01-03 14:02:54 -0600
commit4c982fda3cb120f72ce23f583e0b2b332b73f86e (patch)
tree841dafeda66887c42aaf653aef3c3b3f16a8f4f0 /bin/build
parent25b99dec06be8b2f47c7cd3eff7ffeda42575089 (diff)
downloadslskd-4c982fda3cb120f72ce23f583e0b2b332b73f86e.tar.gz
tweak build scripts
Diffstat (limited to 'bin/build')
-rwxr-xr-xbin/build62
1 files changed, 46 insertions, 16 deletions
diff --git a/bin/build b/bin/build
index 6eaf55e0..23eaa5d0 100755
--- a/bin/build
+++ b/bin/build
@@ -1,16 +1,42 @@
#!/bin/bash
set -e
+web_only=false
+skip_tests=false
+
+while test $# -gt 0; do
+ case "$1" in
+ -h|--help)
+ echo 'options:'
+ echo '-h, --help show help'
+ echo '--web-only skip dotnet build'
+ echo '--skip-tests skip execution of npm and dotnet tests'
+ exit 0
+ ;;
+ --web-only)
+ web_only=true
+ shift
+ ;;
+ --skip-tests)
+ skip_tests=true
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
# build web
cd src/web
echo $'\n> pwd\n'
pwd
-echo $'\n> npm install\n'
-npm install
+echo $'\n> npm ci\n'
+npm ci
-if [ ! "$1" == "--skip-tests" ]; then
+if [ "$skip_tests" == false ]; then
echo $'\n> npm run test-unattended\n'
npm run test-unattended
else
@@ -29,23 +55,27 @@ touch ../slskd/wwwroot/.gitkeep
echo $'\n> cp -r build/* ../slskd/wwwroot/\n'
cp -r build/* ../slskd/wwwroot/
-# build api + web
-cd ../slskd
+if [ "$web_only" == true ]; then
+ echo $'\ndotnet build skipped\n'
+else
+ # build api + web
+ cd ../slskd
-echo $'\n> pwd\n'
-pwd
+ echo $'\n> pwd\n'
+ pwd
-echo $'\n> dotnet build --no-incremental --nologo --configuration Release\n'
-dotnet build --no-incremental --nologo --configuration Release
+ echo $'\n> dotnet build --no-incremental --nologo --configuration Release\n'
+ dotnet build --no-incremental --nologo --configuration Release
-if [ ! "$1" == "--skip-tests" ]; then
- echo $'\n> dotnet test --configuration Release ../../tests/slskd.Tests.Unit'
- dotnet test --configuration Release ../../tests/slskd.Tests.Unit
+ if [ "$skip_tests" == false ]; then
+ echo $'\n> dotnet test --configuration Release ../../tests/slskd.Tests.Unit'
+ dotnet test --configuration Release ../../tests/slskd.Tests.Unit
- echo $'\n> ddotnet test --configuration Release ../../tests/slskd.Tests.Integration'
- dotnet test --configuration Release ../../tests/slskd.Tests.Integration
-else
- echo $'\ntests skipped\n'
+ echo $'\n> ddotnet test --configuration Release ../../tests/slskd.Tests.Integration'
+ dotnet test --configuration Release ../../tests/slskd.Tests.Integration
+ else
+ echo $'\ntests skipped\n'
+ fi
fi
echo $'\nbuild succeded.' \ No newline at end of file