fix lib issues #617
This file contains hidden or 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
| name: Test Shiny App Startup | |
| # Fast smoke test: pull the prebuilt environment image from Docker Hub and | |
| # check that the CURRENT (checked-out) app code starts inside it. | |
| on: [push] | |
| jobs: | |
| smoke: | |
| runs-on: ubuntu-latest | |
| # Generous timeout: if this push changed renv.lock, build-image.yml is | |
| # building the matching image in parallel and we wait for it (below). | |
| timeout-minutes: 75 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # The image tag is derived from THIS commit's renv.lock, so we always test | |
| # against exactly the environment the lockfile describes. | |
| - name: Resolve image tag | |
| id: img | |
| run: echo "tag=pauljonasjost/comicsart:lock-$(sha256sum program/renv.lock | cut -c1-8)" >> "$GITHUB_OUTPUT" | |
| # Wait for the matching image to be available. If renv.lock just changed, | |
| # build-image.yml is building it now, so we retry until it's pushed | |
| # (rather than testing against the wrong environment). Unchanged locks are | |
| # already on Docker Hub, so the first pull succeeds immediately. | |
| - name: Pull image (wait for build-image.yml if env just changed) | |
| run: | | |
| TAG="${{ steps.img.outputs.tag }}" | |
| for i in $(seq 1 120); do | |
| if docker pull "$TAG"; then | |
| echo "Pulled $TAG" | |
| exit 0 | |
| fi | |
| echo "[$i/120] $TAG not on Docker Hub yet (build-image.yml may still be running); retrying in 30s..." | |
| sleep 30 | |
| done | |
| echo "Timed out waiting for $TAG — did the image build fail?" | |
| exit 1 | |
| - name: Start app (current code mounted into prebuilt env) | |
| run: | | |
| docker run -d --name comicsart_app -p 3838:3838 \ | |
| -e MODE=app \ | |
| -v "${{ github.workspace }}/program/shinyApp":/srv/shiny-server/shinyApp \ | |
| "${{ steps.img.outputs.tag }}" | |
| - name: Wait for the app to respond | |
| run: | | |
| for i in $(seq 1 30); do | |
| if curl -sSf http://localhost:3838 >/dev/null 2>&1; then | |
| echo "App responded on attempt $i" | |
| exit 0 | |
| fi | |
| echo "waiting for app... ($i)" | |
| sleep 5 | |
| done | |
| echo "App did not respond within timeout" | |
| exit 1 | |
| - name: Show app logs (always) | |
| if: always() | |
| run: docker logs comicsart_app || true | |
| - name: Clean up | |
| if: always() | |
| run: docker rm -f comicsart_app || true |