2022-11-05 06:04:13 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
|
2023-01-11 05:50:32 +03:00
|
|
|
source ../tools.sh
|
|
|
|
|
2022-11-05 06:04:13 +03:00
|
|
|
BUILD_ID=$((RANDOM % 7200 + 600))
|
2023-01-05 09:25:51 +03:00
|
|
|
BROWSER="electron" # Default. Will try to use Google Chrome.
|
2023-01-05 09:15:10 +03:00
|
|
|
|
|
|
|
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
|
2022-11-05 06:04:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Bundle the updated web code into the server codebase.
|
2023-01-05 09:25:51 +03:00
|
|
|
if [ -z "$SKIP_BUILD" ]; then
|
2023-01-05 09:15:10 +03:00
|
|
|
echo "Bundling web code into server..."
|
2023-01-12 07:11:13 +03:00
|
|
|
|
|
|
|
# Change to the root directory of the repository
|
|
|
|
pushd "$(git rev-parse --show-toplevel)"
|
|
|
|
|
2023-01-05 09:15:10 +03:00
|
|
|
./build/web/bundleWeb.sh >/dev/null
|
2023-01-12 07:11:13 +03:00
|
|
|
|
|
|
|
popd
|
2023-01-05 09:15:10 +03:00
|
|
|
else
|
|
|
|
echo "Skipping web build..."
|
|
|
|
fi
|
2022-11-05 06:04:13 +03:00
|
|
|
|
2023-01-12 07:11:13 +03:00
|
|
|
|
2022-11-05 06:04:13 +03:00
|
|
|
# Install the web test framework
|
2023-01-05 09:15:10 +03:00
|
|
|
if [ -z "$SKIP_BUILD" ]; then
|
|
|
|
echo "Installing test dependencies..."
|
|
|
|
npm install --quiet --no-progress
|
2022-11-05 06:04:13 +03:00
|
|
|
|
2023-01-05 09:15:10 +03:00
|
|
|
else
|
|
|
|
echo "Skipping dependencies installation"
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -o nounset
|
2022-11-05 06:04:13 +03:00
|
|
|
|
2023-01-12 07:11:13 +03:00
|
|
|
install_ffmpeg
|
2022-11-05 06:04:13 +03:00
|
|
|
|
2023-01-12 07:11:13 +03:00
|
|
|
start_owncast
|
2022-11-05 06:04:13 +03:00
|
|
|
|
|
|
|
# Run cypress browser tests for desktop
|
2023-01-05 09:15:10 +03:00
|
|
|
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"
|
2022-11-05 06:04:13 +03:00
|
|
|
# Run cypress browser tests for mobile
|
2023-01-05 09:15:10 +03:00
|
|
|
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
|
2022-11-05 06:04:13 +03:00
|
|
|
|
2023-01-12 07:11:13 +03:00
|
|
|
start_stream
|
2022-11-05 06:04:13 +03:00
|
|
|
|
|
|
|
# Run cypress browser tests for desktop
|
2023-01-05 09:15:10 +03:00
|
|
|
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"
|
2022-11-05 06:04:13 +03:00
|
|
|
# Run cypress browser tests for mobile
|
2023-01-05 09:15:10 +03:00
|
|
|
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
|