From 36f8799f39b40f00fc7d5ff2c07a087cfe95dcf7 Mon Sep 17 00:00:00 2001 From: devlikepro Date: Fri, 13 Sep 2024 10:39:42 +0700 Subject: [PATCH] [core] add goss --- .github/workflows/build.yaml | 37 ++++++++++++++++++++++++++++++++++-- tests/smoke/goss.yaml | 7 +++++++ tests/smoke/goss_wait.yaml | 5 +++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 tests/smoke/goss.yaml create mode 100644 tests/smoke/goss_wait.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index be9e631e..f02ddec5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Release on: push: branches: - - "smoke-tests" + - 'smoke-tests' tags: - '*' @@ -19,36 +19,42 @@ jobs: tag: 'latest' platform: 'amd64' browser: 'chromium' + goss: 'goss-linux-amd64' # Chromium - ARM - runner: 'buildjet-4vcpu-ubuntu-2204-arm' tag: 'arm' platform: 'linux/arm64' browser: 'chromium' + goss: 'goss-linux-arm' # Chrome - x86 - runner: 'buildjet-4vcpu-ubuntu-2204' tag: 'chrome' platform: 'amd64' browser: 'chrome' + goss: 'goss-linux-amd64' # Chrome - ARM (Chrome is not available for ARM) #- runner: "buildjet-4vcpu-ubuntu-2204-arm" # tag: "chrome-arm" # platform: "linux/arm64" # browser: "chrome" + # goss: 'goss-linux-arm' # No browser - x86 - runner: 'buildjet-4vcpu-ubuntu-2204' tag: 'noweb' platform: 'amd64' browser: 'none' + goss: 'goss-linux-amd64' # No browser - ARM - runner: 'buildjet-4vcpu-ubuntu-2204-arm' tag: 'noweb-arm' platform: 'linux/arm64' browser: 'none' + goss: 'goss-linux-arm' steps: - name: Checkout @@ -73,7 +79,34 @@ jobs: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_TOKEN }} - - name: Build and push + - name: Build + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile + platforms: ${{ matrix.platform }} + build-args: | + USE_BROWSER=${{ matrix.browser }} + push: false + load: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Install goss + env: + GOSS_DOWNLOAD: 'https://github.com/goss-org/goss/releases/download' + GOSS_VERSION: 'v0.4.8' + run: | + curl -L ${{ env.GOSS_DOWNLOAD }}/${{ env.GOSS_VERSION }}/dgoss -o /usr/local/bin/dgoss + chmod +rx /usr/local/bin/dgoss + + curl -L https://github.com/goss-org/goss/releases/download/${{ GOSS_VERSION }}/${{ matrix.goss }} -o ~/Downloads/goss + chmod +rx ~/Downloads/goss + export GOSS_PATH=~/Downloads/goss + + dgoss run -p3000:3000 --rm ${{ matrix.tag }} + + - name: Push uses: docker/build-push-action@v4 with: context: . diff --git a/tests/smoke/goss.yaml b/tests/smoke/goss.yaml new file mode 100644 index 00000000..42f520ad --- /dev/null +++ b/tests/smoke/goss.yaml @@ -0,0 +1,7 @@ +http: + http://localhost:3000/api/server/version/: + status: 200 + allow-insecure: true + no-follow-redirects: true + timeout: 5000 + body: ['version'] diff --git a/tests/smoke/goss_wait.yaml b/tests/smoke/goss_wait.yaml new file mode 100644 index 00000000..cd11f7ae --- /dev/null +++ b/tests/smoke/goss_wait.yaml @@ -0,0 +1,5 @@ +port: + tcp:3000: + listening: true + ip: + - 0.0.0.0