From db3e68f12e01686ff544a11aff33c4cef1987a7b Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Thu, 5 May 2022 12:16:33 -0400 Subject: [PATCH] Run builds in parallel except for plugin test --- Dockerfile.plugin | 17 +++++++++-------- Makefile | 21 +++++++-------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Dockerfile.plugin b/Dockerfile.plugin index f43e3a4..c1ea8fb 100644 --- a/Dockerfile.plugin +++ b/Dockerfile.plugin @@ -116,28 +116,29 @@ ENV USER root ENV MIMIC_DIR /tmp/mycroft/cache/tts/Mimic3TTSPlugin # Start relevant services: -# 1. Start message bus, wait for ready message in log (5 min timeout) -# 2. Start audio service, wait for ready message in log (5 min timeout) +# 1. Start message bus, wait for ready message in log (10 min timeout) +# 2. Start audio service, wait for ready message in log (10 min timeout) # 3. Run mycroft-speak with sample text -# 4. Watch cache directory for a file creation (5 min timeout) +# 4. Watch cache directory for a file creation (10 min timeout) # 5. Copy first WAV file to known location -RUN mycroft-core/bin/mycroft-start bus && \ - timeout 300 tail -n+0 -f /var/log/mycroft/bus.log | grep -iq 'message bus service started' && \ +RUN export timeout_sec='600' && \ + mycroft-core/bin/mycroft-start bus && \ + timeout "${timeout_sec}" tail -n+0 -f /var/log/mycroft/bus.log | grep -iq 'message bus service started' && \ echo 'Message bus started' && \ mycroft-core/bin/mycroft-start audio && \ - timeout 300 tail -n+0 -f /var/log/mycroft/audio.log | grep -iq 'audio service is ready' && \ + timeout "${timeout_sec}" tail -n+0 -f /var/log/mycroft/audio.log | grep -iq 'audio service is ready' && \ echo 'Audio service started' && \ xargs -a tests/apope_sample.txt mycroft-core/bin/mycroft-speak && \ echo 'Speak request sent' && \ mkdir -p "${MIMIC_DIR}" && \ - for i in $(seq 1 300); do \ + for i in $(seq 1 "${timeout_sec}"); do \ wav_path="$(find "${MIMIC_DIR}" -name '*.wav' | head -n1)"; \ if [ -n "${wav_path}" ]; then \ mv "${wav_path}" tests/actual_sample.wav; \ break; \ fi; \ sleep 1; \ - echo "Looking for WAV file in ${MIMIC_DIR}"; \ + echo "${i}/${timeout_sec}: Looking for WAV file in ${MIMIC_DIR}"; \ done # Check sample diff --git a/Makefile b/Makefile index 8f0f57e..39fc9fd 100644 --- a/Makefile +++ b/Makefile @@ -25,10 +25,7 @@ DOCKER_TAG ?= mycroftai/mimic3 # Build source distributions for PyPI. # Also tests installation. dist: - echo "$(DOCKER_PLATFORM)" | sed -e 's/,/\n/g' | \ - while read -r platform; do \ - docker buildx build . -f Dockerfile.dist --platform "$${platform}" --output "type=local,dest=dist/"; \ - done + docker buildx build . -f Dockerfile.dist --platform "$(DOCKER_PLATFORM)" --output 'type=local,dest=dist/'; \ # Create virtual environment and install in editable mode locally. install: @@ -37,7 +34,7 @@ install: # Create self-contained Docker image. # Also tests functionality. docker: - docker buildx build . -f Dockerfile --platform $(DOCKER_PLATFORM) --tag "$(DOCKER_TAG)" $(DOCKER_OUTPUT) + docker buildx build . -f Dockerfile --platform "$(DOCKER_PLATFORM)" --tag "$(DOCKER_TAG)" $(DOCKER_OUTPUT) # Create self-container Docker image with GPU support. # Requires nvidia-docker. @@ -48,24 +45,20 @@ docker-gpu: # These are different per platform (amd64, etc.). # It's critical that deterministic mode is used to generate and test. sample: - echo "$(DOCKER_PLATFORM)" | sed -e 's/,/\n/g' | \ - while read -r platform; do \ - docker buildx build . -f Dockerfile.sample --platform "$${platform}" --output "type=local,dest=tests/"; \ - done + docker buildx build . -f Dockerfile.sample --platform "$(DOCKER_PLATFORM)" --output 'type=local,dest=tests/'; \ # Create Debian packages (packaged with apope voice). # Also tests installation. debian: - echo "$(DOCKER_PLATFORM)" | sed -e 's/,/\n/g' | \ - while read -r platform; do \ - docker buildx build . -f Dockerfile.debian --platform "$${platform}" --output "type=local,dest=dist/"; \ - done + docker buildx build . -f Dockerfile.debian --platform "$(DOCKER_PLATFORM)" --output 'type=local,dest=dist/'; \ # Build TTS plugin distribution package. # https://github.com/MycroftAI/plugin-tts-mimic3 +# # Also tests with latest Mycroft. +# Cannot run tests in parallel because of message bus port conflicts. plugin-dist: echo "$(DOCKER_PLATFORM)" | sed -e 's/,/\n/g' | \ while read -r platform; do \ - docker buildx build . -f Dockerfile.plugin --platform "$${platform}" --output "type=local,dest=dist/"; \ + docker buildx build . -f Dockerfile.plugin --platform "$${platform}" --output 'type=local,dest=dist/'; \ done