From 553210f9eec2eec803cf1c898aa63a348871563b Mon Sep 17 00:00:00 2001 From: hermaplusplus <49307226+hermaplusplus@users.noreply.github.com> Date: Wed, 11 Feb 2026 21:35:00 +0000 Subject: [PATCH] Add docker smoke test workflow --- .github/workflows/docker-smoke-test.yml | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/docker-smoke-test.yml diff --git a/.github/workflows/docker-smoke-test.yml b/.github/workflows/docker-smoke-test.yml new file mode 100644 index 0000000..ade3142 --- /dev/null +++ b/.github/workflows/docker-smoke-test.yml @@ -0,0 +1,52 @@ +name: Docker Build Smoke Test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + smoke-test: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build + run: | + docker compose build \ + --build-arg GIT_BRANCH="${{ github.ref_name }}" \ + --build-arg GIT_COMMIT="${{ github.sha }}" + + - name: Start container + run: docker compose up -d + + - name: Wait for Streamlit to init and check health + run: | + echo "Waiting for Streamlit to be init..." + # checks the health endpoint every 5 seconds for up to 120 seconds + for i in {1..24}; do + if curl -s -f http://localhost:8501/_stcore/health > /dev/null; then + echo "✅ Streamlit is up and running!" + exit 0 + fi + echo "Attempt $i: App not ready yet. Retrying in 5s..." + sleep 5 + done + + echo "❌ App failed to start within timeout." + exit 1 + + - name: Show container logs on failure + if: failure() + run: docker compose logs app + + - name: Tear down + if: always() + run: docker compose down \ No newline at end of file