aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-29 11:59:29 +0200
committerChocobozzz <me@florianbigard.com>2019-07-29 13:40:39 +0200
commit2284f202070aa2e49156cc52b3b1596a7d5aadec (patch)
tree77aeb00016734667f8ff32a98ea8b4a6ed3ca31e /scripts
parent112be80ebdf96ef6a27420c1c6a10097388731a9 (diff)
downloadPeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.tar.gz
PeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.tar.zst
PeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.zip
Add gitlab ci support
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ci.sh (renamed from scripts/travis.sh)8
-rwxr-xr-xscripts/clean/server/test.sh13
-rwxr-xr-xscripts/nightly.sh42
-rwxr-xr-xscripts/test.sh2
4 files changed, 56 insertions, 9 deletions
diff --git a/scripts/travis.sh b/scripts/ci.sh
index 42e2329c6..1819f73dd 100755
--- a/scripts/travis.sh
+++ b/scripts/ci.sh
@@ -22,16 +22,16 @@ elif [ "$1" = "cli" ]; then
22 mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/cli/index.ts 22 mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/cli/index.ts
23elif [ "$1" = "api-1" ]; then 23elif [ "$1" = "api-1" ]; then
24 npm run build:server 24 npm run build:server
25 sh ./server/tests/api/travis-1.sh 2 25 sh ./server/tests/api/ci-1.sh 2
26elif [ "$1" = "api-2" ]; then 26elif [ "$1" = "api-2" ]; then
27 npm run build:server 27 npm run build:server
28 sh ./server/tests/api/travis-2.sh 2 28 sh ./server/tests/api/ci-2.sh 2
29elif [ "$1" = "api-3" ]; then 29elif [ "$1" = "api-3" ]; then
30 npm run build:server 30 npm run build:server
31 sh ./server/tests/api/travis-3.sh 2 31 sh ./server/tests/api/ci-3.sh 2
32elif [ "$1" = "api-4" ]; then 32elif [ "$1" = "api-4" ]; then
33 npm run build:server 33 npm run build:server
34 sh ./server/tests/api/travis-4.sh 2 34 sh ./server/tests/api/ci-4.sh 2
35elif [ "$1" = "lint" ]; then 35elif [ "$1" = "lint" ]; then
36 npm run tslint -- --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" "shared/**/*.ts" 36 npm run tslint -- --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" "shared/**/*.ts"
37 37
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh
index 20745170d..dbd399aaa 100755
--- a/scripts/clean/server/test.sh
+++ b/scripts/clean/server/test.sh
@@ -5,7 +5,7 @@ set -eu
5recreateDB () { 5recreateDB () {
6 dbname="peertube_test$1" 6 dbname="peertube_test$1"
7 7
8 dropdb --if-exists "$dbname" 8 dropdb --if-exists "$dbname" 2>&1
9 9
10 createdb -O peertube "$dbname" 10 createdb -O peertube "$dbname"
11 psql -c "CREATE EXTENSION pg_trgm;" "$dbname" & 11 psql -c "CREATE EXTENSION pg_trgm;" "$dbname" &
@@ -18,10 +18,15 @@ removeFiles () {
18 18
19dropRedis () { 19dropRedis () {
20 port=$((9000+$1)) 20 port=$((9000+$1))
21 host="localhost"
21 22
22 redis-cli KEYS "bull-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL 23 if [ ! -z ${GITLAB_CI+x} ]; then
23 redis-cli KEYS "redis-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL 24 host="redis"
24 redis-cli KEYS "*redis-localhost:$port-" | grep -v empty | xargs --no-run-if-empty redis-cli DEL 25 fi
26
27 redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL
28 redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL
29 redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL
25} 30}
26 31
27seq=$(seq 1 6) 32seq=$(seq 1 6)
diff --git a/scripts/nightly.sh b/scripts/nightly.sh
new file mode 100755
index 000000000..bde5d57b9
--- /dev/null
+++ b/scripts/nightly.sh
@@ -0,0 +1,42 @@
1#!/bin/bash
2
3set -eu
4
5shutdown() {
6 # Get our process group id
7 # shellcheck disable=SC2009
8 PGID=$(ps -o pgid= $$ | grep -o "[0-9]*")
9
10 # Kill it in a new new process group
11 setsid kill -- -"$PGID"
12 exit 0
13}
14
15trap "shutdown" SIGINT SIGTERM
16
17today=$(date '+%F')
18directory_name="peertube-nightly-$today"
19tar_name="peertube-nightly-$today.tar.xz"
20
21npm run build
22
23# Creating the archives
24(
25 # local variables
26 directories_to_archive=("$directory_name/CREDITS.md" "$directory_name/FAQ.md" \
27 "$directory_name/LICENSE" "$directory_name/README.md" \
28 "$directory_name/client/dist/" "$directory_name/client/yarn.lock" \
29 "$directory_name/client/package.json" "$directory_name/config" \
30 "$directory_name/dist" "$directory_name/package.json" \
31 "$directory_name/scripts" "$directory_name/support" \
32 "$directory_name/tsconfig.json" "$directory_name/yarn.lock")
33
34 # temporary setup
35 cd ..
36 ln -s "PeerTube" "$directory_name"
37
38 XZ_OPT=-e9 tar cfJ "PeerTube/$tar_name" "${directories_to_archive[@]}"
39
40 # temporary setup destruction
41 rm "$directory_name"
42)
diff --git a/scripts/test.sh b/scripts/test.sh
index 5ec7a5920..1b6b29b66 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -5,6 +5,6 @@ set -eu
5npm run build:server 5npm run build:server
6npm run setup:cli 6npm run setup:cli
7 7
8npm run travis -- lint 8npm run ci -- lint
9 9
10mocha --exit --require ts-node/register/type-check --bail server/tests/index.ts 10mocha --exit --require ts-node/register/type-check --bail server/tests/index.ts