From d9ca573e24c1dcfc627b241ace5fbdbefd9eaecd Mon Sep 17 00:00:00 2001 From: Nathan ter Bogt Date: Fri, 31 Oct 2025 16:36:49 +1300 Subject: [PATCH 1/3] Testing build without docker credentials (#36) --- .github/workflows/build-push.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index dfe0b86..616891d 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -37,18 +37,18 @@ jobs: node: [ '20', '22', '24' ] steps: - - name: 🔑 Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} +# - name: 🔑 Login to Docker Hub +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: 🔑 Log in to the GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} +# - name: 🔑 Log in to the GitHub Container Registry +# uses: docker/login-action@v3 +# with: +# registry: ghcr.io +# username: ${{ github.actor }} +# password: ${{ secrets.GITHUB_TOKEN }} - name: 🐋 Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 4288d2e732b7f482ace852fb97e36b17328b51f8 Mon Sep 17 00:00:00 2001 From: Nathan ter Bogt Date: Fri, 31 Oct 2025 17:03:46 +1300 Subject: [PATCH 2/3] Revert creds (#37) --- .github/workflows/build-push.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 616891d..dfe0b86 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -37,18 +37,18 @@ jobs: node: [ '20', '22', '24' ] steps: -# - name: 🔑 Login to Docker Hub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: 🔑 Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} -# - name: 🔑 Log in to the GitHub Container Registry -# uses: docker/login-action@v3 -# with: -# registry: ghcr.io -# username: ${{ github.actor }} -# password: ${{ secrets.GITHUB_TOKEN }} + - name: 🔑 Log in to the GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: 🐋 Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 66ff0076e92baa2897797dc64765d395df1e9ea1 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 31 Oct 2025 21:01:08 +1000 Subject: [PATCH 3/3] Use bats --- Dockerfile | 9 ++++++--- goss.yml | 18 ------------------ tests.bats | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 21 deletions(-) delete mode 100644 goss.yml create mode 100644 tests.bats diff --git a/Dockerfile b/Dockerfile index 57f018f..2ebb588 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,9 +59,12 @@ ENV PATH=/data/node_modules/.bin:$PATH # Temporary build stage where we can run the test suite. FROM base AS test -COPY --from=ghcr.io/goss-org/goss:latest /usr/bin/goss /usr/bin/goss -ADD goss.yml /tmp/goss.yml -RUN goss --gossfile=/tmp/goss.yml validate + +USER root +RUN apk add bats + +ADD tests.bats /tmp/tests.bats +RUN bats /tmp/tests.bats FROM base AS run CMD ["bash"] diff --git a/goss.yml b/goss.yml deleted file mode 100644 index 23ae89f..0000000 --- a/goss.yml +++ /dev/null @@ -1,18 +0,0 @@ -command: - npm: - exec: "npm --help" - exit-status: 1 - stdout: - - DISCLAIMER - - yarn: - exec: "yarn --help" - exit-status: 0 - stdout: - - DISCLAIMER - - pnpm: - exec: "pnpm --help" - exit-status: 0 - stdout: - - "compiled to binary" diff --git a/tests.bats b/tests.bats new file mode 100644 index 0000000..40afde8 --- /dev/null +++ b/tests.bats @@ -0,0 +1,25 @@ +#!/usr/bin/env bats + +setup() { + # load helper libraries when using the official Docker image + bats_load_library bats-support + bats_load_library bats-assert +} + +@test "npm --help exits 1 and mentions DISCLAIMER" { + run npm --help + [ "$status" -eq 1 ] + assert_output --partial "DISCLAIMER" +} + +@test "yarn --help exits 0 and mentions DISCLAIMER" { + run yarn --help + [ "$status" -eq 0 ] + assert_output --partial "DISCLAIMER" +} + +@test "pnpm --help exits 0 and mentions 'compiled to binary'" { + run pnpm --help + [ "$status" -eq 0 ] + assert_output --partial "compiled to binary" +}