aboutsummaryrefslogtreecommitdiffstats
path: root/bin/build
blob: 6eaf55e0b7a834eb3ead810e47e75b18c4b2570f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -e

# build web
cd src/web

echo $'\n> pwd\n'
pwd

echo $'\n> npm install\n'
npm install

if [ ! "$1" == "--skip-tests" ]; then
    echo $'\n> npm run test-unattended\n'
    npm run test-unattended
else
    echo $'\ntests skipped\n'
fi

echo $'\n> npm run build\n'
npm run build

# remove old build, but keep .gitkeep
rm -rf ../slskd/wwwroot
mkdir ../slskd/wwwroot
touch ../slskd/wwwroot/.gitkeep

# copy new files
echo $'\n> cp -r build/* ../slskd/wwwroot/\n'
cp -r build/* ../slskd/wwwroot/

# build api + web
cd ../slskd

echo $'\n> pwd\n'
pwd

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

    echo $'\n> ddotnet test --configuration Release ../../tests/slskd.Tests.Integration'
    dotnet test --configuration Release ../../tests/slskd.Tests.Integration
else
    echo $'\ntests skipped\n'
fi

echo $'\nbuild succeded.'