From 287b8fec87c592bda07fe5bbe89b773f887b060d Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Tue, 13 Jan 2026 09:46:40 +1100 Subject: [PATCH 1/5] Remove bats submodules and use official bats-core action --- .github/workflows/build-push.yml | 7 ++++--- .gitmodules | 6 ------ tests/k8s.bats | 4 +--- tests/nginx.bats | 4 +--- tests/s3-rollback.bats | 6 ++---- tests/s3-upgrade.bats | 6 ++---- tests/s3.bats | 6 ++---- tests/setup.bash | 12 ++++++++++++ tests/test_helpers/bats-assert | 1 - tests/test_helpers/bats-support | 1 - 10 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 .gitmodules create mode 100644 tests/setup.bash delete mode 160000 tests/test_helpers/bats-assert delete mode 160000 tests/test_helpers/bats-support diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 040e8a7..4f429bd 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -93,9 +93,8 @@ jobs: password: ${{ secrets.PANUBUILD_QUAYIO_TOKEN }} - name: Setup BATS - uses: panubo/setup-bats-action@v2 - with: - bats-version: 1.7.0 + id: setup-bats + uses: bats-core/bats-action@3.0.1 - name: Build and export to Docker uses: docker/build-push-action@v6 @@ -106,6 +105,8 @@ jobs: tags: ${{ steps.image_name.outputs.image_name }}:test - name: Test + env: + BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} run: | make _ci_test diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index a39d398..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "tests/test_helpers/bats-support"] - path = tests/test_helpers/bats-support - url = https://github.com/bats-core/bats-support.git -[submodule "tests/test_helpers/bats-assert"] - path = tests/test_helpers/bats-assert - url = https://github.com/bats-core/bats-assert.git diff --git a/tests/k8s.bats b/tests/k8s.bats index 104c42b..8069bbe 100644 --- a/tests/k8s.bats +++ b/tests/k8s.bats @@ -1,7 +1,5 @@ -load test_helpers/bats-support/load -load test_helpers/bats-assert/load load functions.bash -# load setup.bash +load setup.bash setup_file() { # Disable parallel execution in this file diff --git a/tests/nginx.bats b/tests/nginx.bats index ae0e97e..f79a9c9 100644 --- a/tests/nginx.bats +++ b/tests/nginx.bats @@ -1,7 +1,5 @@ -load test_helpers/bats-support/load -load test_helpers/bats-assert/load load functions.bash -# load setup.bash +load setup.bash setup_file() { container="$(docker run -d -p 8080 panubo/staticsite-testsite:1 nginx)" diff --git a/tests/s3-rollback.bats b/tests/s3-rollback.bats index 5acead8..459a46f 100644 --- a/tests/s3-rollback.bats +++ b/tests/s3-rollback.bats @@ -1,7 +1,5 @@ -load test_helpers/bats-support/load -load test_helpers/bats-assert/load load functions.bash -# load setup.bash +load setup.bash setup_file() { # Disable parallel execution in this file @@ -32,7 +30,7 @@ setup_file() { } # setup() { - + # } teardown_file() { diff --git a/tests/s3-upgrade.bats b/tests/s3-upgrade.bats index 18d5c2b..03fc2af 100644 --- a/tests/s3-upgrade.bats +++ b/tests/s3-upgrade.bats @@ -1,7 +1,5 @@ -load test_helpers/bats-support/load -load test_helpers/bats-assert/load load functions.bash -# load setup.bash +load setup.bash setup_file() { # Disable parallel execution in this file @@ -41,7 +39,7 @@ setup_file() { } # setup() { - + # } teardown_file() { diff --git a/tests/s3.bats b/tests/s3.bats index 099b4d3..c9fe275 100644 --- a/tests/s3.bats +++ b/tests/s3.bats @@ -1,7 +1,5 @@ -load test_helpers/bats-support/load -load test_helpers/bats-assert/load load functions.bash -# load setup.bash +load setup.bash setup_file() { @@ -43,7 +41,7 @@ setup_file() { } # setup() { - + # } teardown_file() { diff --git a/tests/setup.bash b/tests/setup.bash new file mode 100644 index 0000000..65167b9 --- /dev/null +++ b/tests/setup.bash @@ -0,0 +1,12 @@ +# Load bats libraries + +BATS_LIB_PATH=${BATS_LIB_PATH:-"~/.bats/libs:/usr/lib/bats"} +if BREW_PREFIX="$(brew --prefix)"; then + BATS_LIB_PATH="${BATS_LIB_PATH}:${BREW_PREFIX}/lib" +fi +export BATS_LIB_PATH +bats_load_library bats-support +bats_load_library bats-assert +bats_load_library bats-file +bats_load_library bats-detik/utils.bash +bats_load_library bats-detik/detik.bash diff --git a/tests/test_helpers/bats-assert b/tests/test_helpers/bats-assert deleted file mode 160000 index e2d855b..0000000 --- a/tests/test_helpers/bats-assert +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e2d855bc78619ee15b0c702b5c30fb074101159f diff --git a/tests/test_helpers/bats-support b/tests/test_helpers/bats-support deleted file mode 160000 index 9bf10e8..0000000 --- a/tests/test_helpers/bats-support +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9bf10e876dd6b624fe44423f0b35e064225f7556 From b85fab875683cff75f50db31a584c7678be3954f Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Tue, 13 Jan 2026 10:04:02 +1100 Subject: [PATCH 2/5] Make bats simpler --- .github/workflows/build-push.yml | 3 --- tests/setup.bash | 6 ++---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 4f429bd..3a85e48 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -93,7 +93,6 @@ jobs: password: ${{ secrets.PANUBUILD_QUAYIO_TOKEN }} - name: Setup BATS - id: setup-bats uses: bats-core/bats-action@3.0.1 - name: Build and export to Docker @@ -105,8 +104,6 @@ jobs: tags: ${{ steps.image_name.outputs.image_name }}:test - name: Test - env: - BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} run: | make _ci_test diff --git a/tests/setup.bash b/tests/setup.bash index 65167b9..ba7b0af 100644 --- a/tests/setup.bash +++ b/tests/setup.bash @@ -1,9 +1,7 @@ # Load bats libraries -BATS_LIB_PATH=${BATS_LIB_PATH:-"~/.bats/libs:/usr/lib/bats"} -if BREW_PREFIX="$(brew --prefix)"; then - BATS_LIB_PATH="${BATS_LIB_PATH}:${BREW_PREFIX}/lib" -fi +# This list of PATHs should cover Linux, Mac and GitHub Actions +BATS_LIB_PATH="~/.bats/libs:/opt/homebrew/lib:/usr/local/bats:/usr/local:/usr/lib/bats:/usr/lib"} export BATS_LIB_PATH bats_load_library bats-support bats_load_library bats-assert From 57fe28b49c31a828a4ed80da597bde022af375a1 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Tue, 13 Jan 2026 10:06:27 +1100 Subject: [PATCH 3/5] Fix typo --- tests/setup.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/setup.bash b/tests/setup.bash index ba7b0af..632919a 100644 --- a/tests/setup.bash +++ b/tests/setup.bash @@ -1,7 +1,9 @@ # Load bats libraries +# See https://github.com/bats-core/homebrew-bats-core for Homebrew install + # This list of PATHs should cover Linux, Mac and GitHub Actions -BATS_LIB_PATH="~/.bats/libs:/opt/homebrew/lib:/usr/local/bats:/usr/local:/usr/lib/bats:/usr/lib"} +BATS_LIB_PATH="~/.bats/libs:/opt/homebrew/lib:/usr/local/bats:/usr/local:/usr/lib/bats:/usr/lib" export BATS_LIB_PATH bats_load_library bats-support bats_load_library bats-assert From 457f49c0053601a8f4d8a3ac666c486158b91bf9 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Tue, 13 Jan 2026 10:20:43 +1100 Subject: [PATCH 4/5] Try publishing test results --- .github/workflows/build-push.yml | 7 +++++++ .gitignore | 1 + Makefile | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 3a85e48..fbd2768 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -107,6 +107,13 @@ jobs: run: | make _ci_test + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: (!cancelled()) + with: + files: | + tests/results/*.xml + - name: Build and Push uses: docker/build-push-action@v6 with: diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dfc4f49 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tests/results diff --git a/Makefile b/Makefile index ebed2c1..28639ad 100644 --- a/Makefile +++ b/Makefile @@ -40,4 +40,5 @@ test: ## run test suite ( cd tests; bats -j 4 . ) _ci_test: - ( cd tests; bats -j 4 . ) + -mkdir tests/results + ( cd tests; bats -j 4 -F pretty --report-formatter junit -o results . ) From 8376a72d99cf84d03ecd7cef481bad862d96a375 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Tue, 13 Jan 2026 10:25:28 +1100 Subject: [PATCH 5/5] Fix tests --- .github/workflows/build-push.yml | 6 ++++-- Makefile | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index fbd2768..64d1617 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -28,8 +28,10 @@ env: GITHUB_ROLE_ARN: arn:aws:iam::461800378586:role/GitHubECRPublic permissions: - id-token: write # Required for OIDC - contents: read # This is required for actions/checkout + id-token: write # Required for OIDC + contents: read # This is required for actions/checkout + checks: write # Required to publish test results + pull-requests: write # Required to publish test results jobs: build_and_push: diff --git a/Makefile b/Makefile index 28639ad..b790813 100644 --- a/Makefile +++ b/Makefile @@ -41,4 +41,4 @@ test: ## run test suite _ci_test: -mkdir tests/results - ( cd tests; bats -j 4 -F pretty --report-formatter junit -o results . ) + ( cd tests; bats -j 4 --report-formatter junit -o results . )