-
-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile.tests: Copy checkout and setup workflow
Copy the git checkout, create the test database, and compile static resources within the Dockerfile rather than as part of the workflow job steps. This will speed up each job by reducing the number of redundant steps.
- Loading branch information
Showing
6 changed files
with
116 additions
and
114 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e -x | ||
|
||
cd "$MBS_ROOT" | ||
|
||
sudo -E -H -u musicbrainz mkdir -p junit_output | ||
|
||
sudo -E -H -u musicbrainz cp docker/musicbrainz-tests/DBDefs.pm lib/ | ||
|
||
sudo -E -H -u postgres /usr/lib/postgresql/16/bin/pg_ctl start -D /var/lib/postgresql/data | ||
|
||
sudo -E -H -u musicbrainz carton exec -- ./script/create_test_db.sh | ||
|
||
# Add the mbtest hostname alias, which is required to name the | ||
# rabbit@mbtest cluster. | ||
./docker/musicbrainz-tests/add_mbtest_alias.sh | ||
|
||
cd /var/lib/postgresql | ||
|
||
# Create clones of the musicbrainz_test DB used by various tests. | ||
sudo -E -H -u postgres createdb -O musicbrainz -T musicbrainz_test -U postgres musicbrainz_selenium | ||
sudo -E -H -u postgres createdb -O musicbrainz -T musicbrainz_test -U postgres musicbrainz_test_json_dump | ||
sudo -E -H -u postgres createdb -O musicbrainz -T musicbrainz_test -U postgres musicbrainz_test_full_export | ||
sudo -E -H -u postgres createdb -O musicbrainz -T musicbrainz_test -U postgres musicbrainz_test_sitemaps | ||
|
||
cd /home/musicbrainz/sir | ||
|
||
service rabbitmq-server start | ||
|
||
# Setup the rabbitmq user/vhost used by pg_amqp + sir. | ||
rabbitmqctl add_user sir sir | ||
rabbitmqctl add_vhost /sir-test | ||
rabbitmqctl set_permissions -p /sir-test sir '.*' '.*' '.*' | ||
|
||
# Generate and install the sir triggers into musicbrainz_selenium. | ||
sudo -E -H -u musicbrainz sh -c '. venv/bin/activate; python -m sir amqp_setup; python -m sir extension; python -m sir triggers --broker-id=1' | ||
|
||
service rabbitmq-server stop | ||
|
||
psql -U postgres -f sql/CreateExtension.sql musicbrainz_selenium | ||
psql -U musicbrainz -f sql/CreateFunctions.sql musicbrainz_selenium | ||
psql -U musicbrainz -f sql/CreateTriggers.sql musicbrainz_selenium | ||
|
||
cd /home/musicbrainz/artwork-indexer | ||
|
||
# Install the artwork_indexer schema into musicbrainz_selenium. | ||
sudo -E -H -u musicbrainz sh -c '. venv/bin/activate; python indexer.py --setup-schema' | ||
|
||
cd "$MBS_ROOT" | ||
|
||
sudo -E -H -u musicbrainz make -C po all_quiet deploy | ||
|
||
# script/dump_js_type_info.pl needs Redis running. | ||
redis-server & | ||
REDIS_PID=$! | ||
|
||
# Compile static resources. | ||
NODE_ENV=test \ | ||
WEBPACK_MODE=development \ | ||
MUSICBRAINZ_RUNNING_TESTS=1 \ | ||
NO_PROGRESS=1 \ | ||
NO_YARN=1 \ | ||
sudo -E -H -u musicbrainz carton exec -- ./script/compile_resources.sh default tests | ||
|
||
kill "$REDIS_PID" | ||
|
||
sudo -E -H -u postgres /usr/lib/postgresql/16/bin/pg_ctl stop -D /var/lib/postgresql/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters