add shellcheck to CI (#2478)

* add shellcheck to ci

* test ci

* install bash for shellcheck

* set globstar for bash

* cleanup shell scripts

* do not ignore automated hls tests

* rm legacy build script

* update shell scripts

* cleanup ci

* Fix misspell

* cleanup ci

* fail on curl error in ci
This commit is contained in:
Meisam
2022-12-26 04:17:13 +01:00
committed by GitHub
parent 52cf00ff85
commit c74d5b4f31
12 changed files with 72 additions and 153 deletions

View File

@@ -8,21 +8,21 @@ npm install --quiet --no-progress
# Download a specific version of ffmpeg
if [ ! -d "ffmpeg" ]; then
mkdir ffmpeg
pushd ffmpeg >/dev/null
pushd ffmpeg >/dev/null || exit
curl -sL https://github.com/vot/ffbinaries-prebuilt/releases/download/v4.2.1/ffmpeg-4.2.1-linux-64.zip --output ffmpeg.zip >/dev/null
unzip -o ffmpeg.zip >/dev/null
PATH=$PATH:$(pwd)
popd >/dev/null
popd >/dev/null || exit
fi
pushd ../../.. >/dev/null
pushd ../../.. >/dev/null || exit
# Build and run owncast from source
go build -o owncast main.go
./owncast -database $TEMP_DB &
./owncast -database "$TEMP_DB" &
SERVER_PID=$!
popd >/dev/null
popd >/dev/null || exit
sleep 5
# Start streaming the test file over RTMP to
@@ -31,7 +31,7 @@ ffmpeg -hide_banner -loglevel panic -stream_loop -1 -re -i ../test.mp4 -vcodec l
FFMPEG_PID=$!
function finish {
rm $TEMP_DB
rm "$TEMP_DB"
kill $SERVER_PID $FFMPEG_PID
}
trap finish EXIT

View File

@@ -26,7 +26,7 @@ if [ ! -d "ffmpeg" ]; then
echo "Downloading ffmpeg..."
mkdir -p /tmp/ffmpeg
pushd /tmp/ffmpeg >/dev/null
curl -sL https://github.com/vot/ffbinaries-prebuilt/releases/download/v4.2.1/ffmpeg-4.2.1-linux-64.zip --output ffmpeg.zip >/dev/null
curl -sL --fail https://github.com/vot/ffbinaries-prebuilt/releases/download/v4.2.1/ffmpeg-4.2.1-linux-64.zip --output ffmpeg.zip
unzip -o ffmpeg.zip >/dev/null
PATH=$PATH:$(pwd)
popd >/dev/null
@@ -36,7 +36,7 @@ fi
echo "Building owncast..."
go build -o owncast main.go
echo "Running owncast..."
./owncast -database $TEMP_DB &
./owncast -database "$TEMP_DB" &
SERVER_PID=$!
pushd test/automated/browser
@@ -54,7 +54,7 @@ STREAMING_CLIENT=$!
function finish {
echo "Cleaning up..."
rm $TEMP_DB
rm "$TEMP_DB"
kill $SERVER_PID $STREAMING_CLIENT
}
trap finish EXIT SIGHUP SIGINT SIGTERM SIGQUIT SIGABRT SIGTERM

View File

@@ -37,12 +37,12 @@ pushd ../../.. >/dev/null
# Build and run owncast from source
go build -o owncast main.go
./owncast -database $TEMP_DB &
./owncast -database "$TEMP_DB" &
SERVER_PID=$!
function finish {
echo "Cleaning up..."
rm $TEMP_DB
rm "$TEMP_DB"
kill $SERVER_PID $STREAMING_CLIENT
}
trap finish EXIT

View File

@@ -4,31 +4,32 @@
# to repeat indefinitely.
# Example: ./test/ocTestStream.sh ~/Downloads/*.mp4 rtmp://localhost/live/abc123
if ! ([[ $1 ]])
if ! [[ $1 ]]
then
echo "ocTestStream is used for sending pre-recorded content to a RTMP server."
echo "Will default to localhost with the stream key of abc123 if one isn't provided."
echo "./ocTestStream.sh *.mp4 [RTMPDESINATION]"
exit
exit
fi
# Make the destination optional and point to localhost with default key
if [[ ${@: -1} == *"rtmp://"* ]]; then
echo "RTMP is specified"
DESTINATION_HOST=${@: -1}
array=( $@ )
ARGS_LEN=${#array[@]}
CONTENT=${array[@]:0:$ARGS_LEN-1}
DESTINATION_HOST=${@: -1}
FILE_COUNT=$( expr ${#} - 1 )
if [[ ${*: -1} == *"rtmp://"* ]]; then
echo "RTMP server is specified"
DESTINATION_HOST=${*: -1}
FILE_COUNT=$(( ${#} - 1 ))
else
echo "RTMP server is not specified"
DESTINATION_HOST="rtmp://localhost/live/abc123"
array=( $@ )
ARGS_LEN=${#array[@]}
CONTENT=${array[@]:0:$ARGS_LEN}
FILE_COUNT=$( expr ${#} )
FILE_COUNT=${#}
fi
if [[ FILE_COUNT -eq 0 ]]; then
echo "ERROR: ocTestStream needs a video file for sending to the RTMP server."
exit
fi
CONTENT=${*:1:${FILE_COUNT}}
# Delete the old list of files if it exists
if test -f list.txt; then
rm list.txt
@@ -44,6 +45,11 @@ function finish {
}
trap finish EXIT
echo "Streaming a loop of ${FILE_COUNT} videos to $DESTINATION_HOST. Warning: If these files differ greatly in formats transitioning from one to another may not always work correctly... ctl+c to exit"
echo "Streaming a loop of ${FILE_COUNT} videos to $DESTINATION_HOST."
if [[ FILE_COUNT -gt 1 ]]; then
echo "Warning: If these files differ greatly in formats transitioning from one to another may not always work correctly."
fi
echo "$CONTENT"
echo "...press ctl+c to exit"
ffmpeg -hide_banner -loglevel panic -stream_loop -1 -re -f concat -safe 0 -i list.txt -vcodec libx264 -profile:v high -g 48 -r 24 -sc_threshold 0 -b:v 1300k -preset veryfast -acodec copy -vf drawtext="fontfile=monofonto.ttf: fontsize=96: box=1: boxcolor=black@0.75: boxborderw=5: fontcolor=white: x=(w-text_w)/2: y=((h-text_h)/2)+((h-text_h)/4): text='%{gmtime\:%H\\\\\:%M\\\\\:%S}'" -f flv $DESTINATION_HOST
ffmpeg -hide_banner -loglevel panic -stream_loop -1 -re -f concat -safe 0 -i list.txt -vcodec libx264 -profile:v high -g 48 -r 24 -sc_threshold 0 -b:v 1300k -preset veryfast -acodec copy -vf drawtext="fontfile=monofonto.ttf: fontsize=96: box=1: boxcolor=black@0.75: boxborderw=5: fontcolor=white: x=(w-text_w)/2: y=((h-text_h)/2)+((h-text_h)/4): text='%{gmtime\:%H\\\\\:%M\\\\\:%S}'" -f flv "$DESTINATION_HOST"