diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 040e8a7..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: @@ -93,9 +95,7 @@ jobs: password: ${{ secrets.PANUBUILD_QUAYIO_TOKEN }} - name: Setup BATS - uses: panubo/setup-bats-action@v2 - with: - bats-version: 1.7.0 + uses: bats-core/bats-action@3.0.1 - name: Build and export to Docker uses: docker/build-push-action@v6 @@ -109,6 +109,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/.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/Makefile b/Makefile index ebed2c1..b790813 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 --report-formatter junit -o results . ) 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..632919a --- /dev/null +++ b/tests/setup.bash @@ -0,0 +1,12 @@ +# 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" +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