diff --git a/.github/workflows/docker-testbed-periodic-rebuild.yaml b/.github/workflows/docker-testbed-periodic-rebuild.yaml new file mode 100644 index 000000000..fd39eeedc --- /dev/null +++ b/.github/workflows/docker-testbed-periodic-rebuild.yaml @@ -0,0 +1,48 @@ +name: Rebuild js testbed image + +on: + workflow_dispatch: + schedule: + # Run weekly, at 2:15pm on Monday (chosen at random) + # https://cron.help/#15_14_*_*_1 + - cron: '15 14 * * 1' + +env: + build_platforms: ${{ vars.BUILD_PLATFORMS || 'linux/amd64' }} + build_image: ${{ vars.BUILD_IMAGE || 'ghcr.io/isso-comments/isso-js-testbed' }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + flavor: | + latest=false + images: ${{ env.build_image }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + + - name: Login to Github Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build docker-js-testbed + run: make docker-testbed + + - name: Push docker-js-testbed image as ${{ env.build_image }} + run: make docker-testbed-push diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index bb3baf0dc..0a45ef7dd 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -41,14 +41,16 @@ jobs: run: docker compose build isso-server - name: Bring up containers + # Don't wait for healthcheck via --wait. This would fail with a + # negative exit code since the isso-client container is expected to + # exit run: docker compose up -d - name: Client unit tests run: make docker-js-unit - - name: Check if containers are up, sleep if not - shell: bash - run: '[ "$(docker inspect --format={{.State.Health.Status}} isso-server)" = "healthy" ] || sleep 5' + - name: Wait for isso-server container to be ready + run: 'for i in $(seq 1 30); do [ "`docker inspect -f {{.State.Health.Status}} isso-server`" == "healthy" ] && s=0 && break || s=$? && sleep 0.3; done; (exit $s)' - name: Client integration tests run: make docker-js-integration diff --git a/docker-compose.yml b/docker-compose.yml index 5648a90ee..fc36eef29 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,17 +14,20 @@ services: #command: /isso/bin/isso -c /config/isso.cfg run environment: ISSO_SETTINGS: "/config/isso-dev.cfg" + ISSO_ENDPOINT: "http://isso-dev.local:8080" healthcheck: - test: wget --no-verbose --tries=1 --spider http://localhost:8080/info || exit 1 - interval: 5s # short timeout needed during start phase - retries: 3 - start_period: 5s - timeout: 3s + # Double $$ for parsing vars inside CMD: https://stackoverflow.com/a/54989793 + # Debug with 'docker inspect --format "{{json .State.Health }}" isso-server | jq' + test: wget --no-verbose --tries=1 --spider $$ISSO_ENDPOINT/info || exit 1 + interval: 1s # time before first check and between subsequent checks + retries: 10 + start_period: 10s + timeout: 10s # If needed, production docker image can also be exposed to host for # non-docker unit/integration testing ports: - 127.0.0.1:8080:8080 - # Expose port 80080 to other containerized services, not to host machine: + # Expose port 8080 to other containerized services, not to host machine: expose: - 8080 networks: @@ -49,6 +52,8 @@ services: dockerfile: docker/Dockerfile-js-testbed environment: ISSO_ENDPOINT: "http://isso-dev.local:8080" + healthcheck: + disable: true # Command may also run from outside docker compose, e.g.: # $ docker run isso-js-testbed [mount, networks, ...] npm run test-integration #command: npm run test-integration diff --git a/docker/Dockerfile-js-testbed b/docker/Dockerfile-js-testbed index 6cf666766..f8b05f59c 100644 --- a/docker/Dockerfile-js-testbed +++ b/docker/Dockerfile-js-testbed @@ -3,9 +3,9 @@ # Note: Do not use alpine images as they do not contain needed GObject, X11 # etc. packages and complicate things -# :current resolves to NodeJS 17 on Debian Buster as of 03/2022 +# :22-bookworm resolves to NodeJS 22 on Debian Bookworm as of 04/2024 # https://hub.docker.com/_/node -FROM docker.io/node:current AS isso-js-testbed +FROM docker.io/node:22-bookworm AS isso-js-testbed WORKDIR /src/ # Install everything necessary to run headless diff --git a/isso/js/tests/screenshots/reference/comment.png b/isso/js/tests/screenshots/reference/comment.png index 62db8f612..6d803c90f 100644 Binary files a/isso/js/tests/screenshots/reference/comment.png and b/isso/js/tests/screenshots/reference/comment.png differ diff --git a/isso/js/tests/screenshots/reference/comment.png.hash b/isso/js/tests/screenshots/reference/comment.png.hash index 4d164b791..752dd0259 100644 --- a/isso/js/tests/screenshots/reference/comment.png.hash +++ b/isso/js/tests/screenshots/reference/comment.png.hash @@ -1 +1 @@ -065f2dfac1c6bc174c8406e574f8890d3bb867b13407809eb9aec184f97c172d +56314990cb566160044f46033a7bd0c4d8be5bb41afa44fa54cf156aed21bbe3 diff --git a/isso/js/tests/screenshots/reference/postbox.png b/isso/js/tests/screenshots/reference/postbox.png index b384313a1..d1ddd1309 100644 Binary files a/isso/js/tests/screenshots/reference/postbox.png and b/isso/js/tests/screenshots/reference/postbox.png differ diff --git a/isso/js/tests/screenshots/reference/postbox.png.hash b/isso/js/tests/screenshots/reference/postbox.png.hash index b16afb9da..1fb65ad85 100644 --- a/isso/js/tests/screenshots/reference/postbox.png.hash +++ b/isso/js/tests/screenshots/reference/postbox.png.hash @@ -1 +1 @@ -0eb72a0e3faaf65c373383e9cfe9359de37e31c7f0e6e38c2b2369eb85f0eba4 +a218440951dbc7312118647c955d0d4480fc46bb6dddd72e0d9459744b471f32 diff --git a/isso/js/tests/screenshots/reference/thread.png b/isso/js/tests/screenshots/reference/thread.png index 549f41203..4e4a02f34 100644 Binary files a/isso/js/tests/screenshots/reference/thread.png and b/isso/js/tests/screenshots/reference/thread.png differ diff --git a/isso/js/tests/screenshots/reference/thread.png.hash b/isso/js/tests/screenshots/reference/thread.png.hash index 49fe505d8..d793091e5 100644 --- a/isso/js/tests/screenshots/reference/thread.png.hash +++ b/isso/js/tests/screenshots/reference/thread.png.hash @@ -1 +1 @@ -3185d06957e792d48d28b47c3e2c7e89353aa8d70757d4c92890d38850a66e54 +78ea677962d3f80607995d9b88d81df2b7787832023cb7f1d64811829d0fc10a