Skip to content

Commit

Permalink
Decompose watch.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
montehurd committed Jul 5, 2024
1 parent 51325f7 commit 2c0c67a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
7 changes: 7 additions & 0 deletions novnc/ensure-novnc-container-up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if docker container ls --format '{{.Names}}' | grep -q "pixel-novnc-1"; then
echo "The pixel-novnc-1 container is already running."
else
docker compose up --no-deps --detach novnc
fi
10 changes: 10 additions & 0 deletions novnc/open-watch-url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

URL="http://localhost:8088/vnc_lite.html?autoconnect=true"

open "$URL" 2>/dev/null || {
printf "\n\033[0;32mThe 'open' command is not available\033[0m\n"
printf "\n\033[0;33mOpen the following URL in your web browser to watch BackstopJS do screen captures inside its docker container:\033[0m\n"
printf "\n\033[1;33m%s\033[0m\n\n" "$URL"
sleep 5
}
7 changes: 4 additions & 3 deletions pixel.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ async function processCommand( type, opts, runSilently = false ) {
const { stdout: stdout2 } = await simpleSpawn.exec( './reset-db.sh' );
console.log( stdout2 );

if (process.env.WATCH_MODE === '1') {
await simpleSpawn.spawn( './novnc/open-watch-url.sh' );
}

if ( opts.a11y ) {
return await runA11yRegressionTests( type, configFile, opts.logResults, opts );
} else {
Expand Down Expand Up @@ -226,9 +230,6 @@ function updateContext( group, type, activeBranch, description ) {
async function prepareDockerEnvironment( opts ) {
await simpleSpawn.spawn( './build-base-regression-image.sh' );
await simpleSpawn.spawn( './start.sh' );
if (process.env.WATCH_MODE === '1') {
await simpleSpawn.spawn( './watch.sh' );
}
await simpleSpawn.spawn(
'docker',
[ 'compose', ...getComposeOpts( [ 'exec', ...( process.env.NONINTERACTIVE ? [ '-T' ] : [] ), 'mediawiki', '/src/main.js', JSON.stringify( opts ) ] ) ]
Expand Down
7 changes: 6 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash

# Start docker containers
docker compose --progress=plain --project-directory . -f ./docker-compose.yml up -d
docker compose --progress=plain --project-directory . -f ./docker-compose.yml up -d

# Start novnc container if needed
if [ "${WATCH_MODE}" = "1" ]; then
./novnc/ensure-novnc-container-up.sh
fi
14 changes: 0 additions & 14 deletions watch.sh

This file was deleted.

0 comments on commit 2c0c67a

Please sign in to comment.