mirror of
https://github.com/owncast/owncast.git
synced 2024-11-26 14:56:14 +03:00
64d3c37fb2
* merge testContent.sh into ocContent.sh * detect ffmpeg ffmpeg or ffmpeg.exe in path, current dir, or parent dir * use ocTestStream in api test * enable verbose logging for api tests * log ffmpeg version * change ffmpeg lookup order * set path properly for using the local ffmpeg * rm double space from transcoder error logs * update tests for new video stream do not test bitrate * set test stream target to 127.0.0.1 * log ffmpeg path * update ffmpeg to v4.4.1 * improve logs * fix ffmpeg installer script * fix api test runner * fix logs * install fonts * cleanup * use ocTestStream.sh for all automated tests * cleanup ocTestStream.sh * cleanup test/automated/hls/run.sh * Fix misspell * fix ffmpeg installer in automated test runners * spell fix * cleanup script * rev quick api tests * cleanup tmp paths properly in automated tests * rm unused ffmpeg package * cleanup * fix s3 test * cache ffmpeg bin for automated tests * shellcheck allow source * rm missplaced file if backup fails * use ffmpeg full path * set lookup path for shellcheck
78 lines
2.5 KiB
Bash
Executable file
78 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -o errexit
|
|
set -o pipefail
|
|
|
|
source ../tools.sh
|
|
|
|
TEMP_DB=$(mktemp)
|
|
BUILD_ID=$((RANDOM % 7200 + 600))
|
|
BROWSER="electron" # Default. Will try to use Google Chrome.
|
|
|
|
if hash google-chrome 2>/dev/null; then
|
|
BROWSER="chrome"
|
|
echo "Using Google Chrome as a browser."
|
|
else
|
|
echo "Google Chrome not found. Using Electron."
|
|
fi
|
|
|
|
# Change to the root directory of the repository
|
|
pushd "$(git rev-parse --show-toplevel)"
|
|
|
|
# Bundle the updated web code into the server codebase.
|
|
if [ -z "$SKIP_BUILD" ]; then
|
|
echo "Bundling web code into server..."
|
|
./build/web/bundleWeb.sh >/dev/null
|
|
else
|
|
echo "Skipping web build..."
|
|
fi
|
|
|
|
# Install the web test framework
|
|
if [ -z "$SKIP_BUILD" ]; then
|
|
echo "Installing test dependencies..."
|
|
pushd test/automated/browser
|
|
npm install --quiet --no-progress
|
|
|
|
popd
|
|
else
|
|
echo "Skipping dependencies installation"
|
|
fi
|
|
|
|
set -o nounset
|
|
|
|
ffmpegInstall
|
|
|
|
# Build and run owncast from source
|
|
echo "Building owncast..."
|
|
go build -o owncast main.go
|
|
|
|
echo "Running owncast..."
|
|
./owncast -database "$TEMP_DB" &
|
|
SERVER_PID=$!
|
|
|
|
pushd test/automated/browser
|
|
|
|
# Run cypress browser tests for desktop
|
|
npx cypress run --browser "$BROWSER" --group "desktop-offline" --env tags=desktop --ci-build-id $BUILD_ID --tag "desktop,offline" --record --key e9c8b547-7a8f-452d-8c53-fd7531491e3b --spec "cypress/e2e/offline/*.cy.js"
|
|
# Run cypress browser tests for mobile
|
|
npx cypress run --browser "$BROWSER" --group "mobile-offline" --ci-build-id $BUILD_ID --tag "mobile,offline" --record --key e9c8b547-7a8f-452d-8c53-fd7531491e3b --spec "cypress/e2e/offline/*.cy.js" --config viewportWidth=375,viewportHeight=667
|
|
|
|
# Start streaming the test file over RTMP to
|
|
# the local owncast instance.
|
|
echo "Waiting for stream to start..."
|
|
../../ocTestStream.sh &
|
|
STREAMING_CLIENT=$!
|
|
|
|
function finish {
|
|
echo "Cleaning up..."
|
|
kill $SERVER_PID $STREAMING_CLIENT
|
|
rm -fr "$TEMP_DB" "$FFMPEG_PATH"
|
|
}
|
|
trap finish EXIT SIGHUP SIGINT SIGTERM SIGQUIT SIGABRT SIGTERM
|
|
|
|
sleep 20
|
|
|
|
# Run cypress browser tests for desktop
|
|
npx cypress run --browser "$BROWSER" --group "desktop-online" --env tags=desktop --ci-build-id $BUILD_ID --tag "desktop,online" --record --key e9c8b547-7a8f-452d-8c53-fd7531491e3b --spec "cypress/e2e/online/*.cy.js"
|
|
# Run cypress browser tests for mobile
|
|
npx cypress run --browser "$BROWSER" --group "mobile-online" --ci-build-id $BUILD_ID --tag "mobile,online" --record --key e9c8b547-7a8f-452d-8c53-fd7531491e3b --spec "cypress/e2e/online/*.cy.js" --config viewportWidth=375,viewportHeight=667
|