From d47f1443b650f95573732a988351de559a0b492b Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Feb 2025 15:55:25 -0700 Subject: [PATCH 01/21] feat: add integration tests steps for go library pull requests --- .github/workflows/go_lib_pull_requests.yml | 47 ++++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index ef0ef3f..e147442 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -14,6 +14,18 @@ on: description: "Go workspace mode" required: false type: string + GO_TEST_UNIT_TAGS: + description: "The tags flag for the unit test go test call. Include -tags flag. Example -tags=unit" + type: string + required: false + default: "" + GO_TEST_INTEGRATION_ENABLED: + type: boolean + default: false + GO_TEST_INTEGRATION_TAGS: + description: "The tags flag for the integration test go test call. Include -tags flag. Example -tags=integration" + type: string + default: "-tags=integration" secrets: GH_CI_PAT: description: "Token password for GitHub auth" @@ -21,6 +33,12 @@ on: CODECOV_TOKEN: description: 'Token for Codecov' required: true + ARTIFACT_REGISTRY: + description: 'Artifact Registry address to which to publish (leave blank to not publish)' + required: false + ARTIFACT_REGISTRY_JSON_KEY: + description: 'Key for publishing to Artifact Registry' + required: false env: GOPRIVATE: ${{ inputs.GOPRIVATE }} jobs: @@ -98,14 +116,37 @@ jobs: "https://github.com" # Go vet every Go module. - name: go vet - run: + run: | find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." # Run unit test for evet Go module. + - name: build coverage output directories + run: | + mkdir -p coverage/unit + mkdir -p coverage/int - name: go test - run: + run: | find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname - | xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." + | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir="${{ github.action_path }}/coverage/unit" + # Login to Artifact Registry if we're pushing to it. + - name: Login to Artifact Registry + env: + ARTIFACT_REGISTRY_JSON_KEY: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} + if: ${{ env.ARTIFACT_REGISTRY_JSON_KEY && inputs.GO_TEST_INTEGRATION_ENABLED }} + uses: docker/login-action@v2 + with: + registry: ${{ secrets.ARTIFACT_REGISTRY }} + username: _json_key + password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} + - name: integration tests + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} + run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... + - name: show coverage output directories + run: | + ls ./coverage/unit + ls ./coverage/int + - name: build coverage.txt + run: go tool covdata textfmt -i=./coverage/int,./coverage/unit -o coverage.txt - name: Upload test coverage results to Codecov uses: codecov/codecov-action@v4 with: From 15488a126069a22e95c39340bcb17ac93524122a Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Feb 2025 16:00:02 -0700 Subject: [PATCH 02/21] chore: try coverdir for integration tests --- .github/workflows/go_lib_pull_requests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index e147442..a275649 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -138,9 +138,12 @@ jobs: registry: ${{ secrets.ARTIFACT_REGISTRY }} username: _json_key password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} + # This will run go tests again, and again output to the coverage/unit directory. + # this relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int + # to seperate out any integration tests - name: integration tests if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} - run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... + run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... -args -test.gocoverdir="${{ github.action_path }}/coverage/unit" - name: show coverage output directories run: | ls ./coverage/unit From a72de06b03c5b9976941048e22d20847b2406ed2 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Feb 2025 16:01:19 -0700 Subject: [PATCH 03/21] chore: attempt another format --- .github/workflows/go_lib_pull_requests.yml | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index a275649..ddc5c07 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -107,6 +107,16 @@ jobs: with: go-version: ${{ matrix.go }} # Use auth to get access to private Git repos for Go code dependencies. + # Login to Artifact Registry if we're pushing to it. + - name: Login to Artifact Registry + env: + ARTIFACT_REGISTRY_JSON_KEY: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} + if: ${{ env.ARTIFACT_REGISTRY_JSON_KEY }} + uses: docker/login-action@v2 + with: + registry: ${{ secrets.ARTIFACT_REGISTRY }} + username: _json_key + password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} - name: Configure git for private modules env: TOKEN: ${{ secrets.GH_CI_PAT }} @@ -128,22 +138,11 @@ jobs: run: | find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir="${{ github.action_path }}/coverage/unit" - # Login to Artifact Registry if we're pushing to it. - - name: Login to Artifact Registry - env: - ARTIFACT_REGISTRY_JSON_KEY: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} - if: ${{ env.ARTIFACT_REGISTRY_JSON_KEY && inputs.GO_TEST_INTEGRATION_ENABLED }} - uses: docker/login-action@v2 - with: - registry: ${{ secrets.ARTIFACT_REGISTRY }} - username: _json_key - password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} - # This will run go tests again, and again output to the coverage/unit directory. - # this relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int + # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} - run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... -args -test.gocoverdir="${{ github.action_path }}/coverage/unit" + run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... - name: show coverage output directories run: | ls ./coverage/unit From a7666d2379bebd3ed1008ed1fa092a367dcb8afd Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Feb 2025 16:03:18 -0700 Subject: [PATCH 04/21] chore: correct workflow format --- .github/workflows/go_lib_pull_requests.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index ddc5c07..154b4dc 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -126,18 +126,16 @@ jobs: "https://github.com" # Go vet every Go module. - name: go vet - run: | - find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname - | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." + run: + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." # Run unit test for evet Go module. - name: build coverage output directories run: | mkdir -p coverage/unit mkdir -p coverage/int - name: go test - run: | - find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname - | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir="${{ github.action_path }}/coverage/unit" + run: + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir="${{ github.action_path }}/coverage/unit" # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests From 5fd8986d057939a0954a3204449cecaff649e9e4 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Feb 2025 16:09:54 -0700 Subject: [PATCH 05/21] chore: attempt another path --- .github/workflows/go_lib_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index 154b4dc..25bbb43 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -135,7 +135,7 @@ jobs: mkdir -p coverage/int - name: go test run: - find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir="${{ github.action_path }}/coverage/unit" + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir="${{ github.workspace }}/coverage/unit" # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests From 55154582d95718cbec510aec495fbecdbbf95ee5 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Feb 2025 16:13:50 -0700 Subject: [PATCH 06/21] chore: correct quotes --- .github/workflows/go_lib_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index 25bbb43..1eb98d2 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -135,7 +135,7 @@ jobs: mkdir -p coverage/int - name: go test run: - find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir="${{ github.workspace }}/coverage/unit" + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests From 02f082a678ef7d7d54f6f14badbdf41aaf0173e8 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Feb 2025 17:32:49 -0700 Subject: [PATCH 07/21] chore: vendor since docker is now involved --- .github/workflows/go_lib_pull_requests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index 1eb98d2..4b34409 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -124,6 +124,9 @@ jobs: run: git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf "https://github.com" + # Vendor Go code needed to build app. + - name: go mod vendor + run: go mod vendor # Go vet every Go module. - name: go vet run: From 157b0a799c7c103cacd3eebbd6289ed175be8a14 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Mon, 17 Feb 2025 09:25:38 -0700 Subject: [PATCH 08/21] chore: vendor with workspace as well --- .github/workflows/go_lib_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index 4b34409..a838add 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -126,7 +126,7 @@ jobs: "https://github.com" # Vendor Go code needed to build app. - name: go mod vendor - run: go mod vendor + run: go mod vendor | go work vendor # Go vet every Go module. - name: go vet run: From d2cc4dda742e4b03ec4131d9a1d08b9618e88d6f Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Wed, 12 Mar 2025 11:45:07 -0600 Subject: [PATCH 09/21] chore: support integration tests for go_app_pull_requests.yml --- .github/workflows/go_app_pull_requests.yml | 57 +++++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 3d8e69a..f74f811 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -10,6 +10,18 @@ on: description: 'GOPRIVATE env for go commands' required: false type: string + GO_TEST_UNIT_TAGS: + description: "The tags flag for the unit test go test call. Include -tags flag. Example -tags=unit" + type: string + required: false + default: "" + GO_TEST_INTEGRATION_ENABLED: + type: boolean + default: false + GO_TEST_INTEGRATION_TAGS: + description: "The tags flag for the integration test go test call. Include -tags flag. Example -tags=integration" + type: string + default: "-tags=integration" secrets: GH_CI_PAT: description: 'Token password for GitHub auth' @@ -17,6 +29,12 @@ on: CODECOV_TOKEN: description: 'Token for Codecov' required: true + ARTIFACT_REGISTRY: + description: 'Artifact Registry address to which to publish (leave blank to not publish)' + required: false + ARTIFACT_REGISTRY_JSON_KEY: + description: 'Key for publishing to Artifact Registry' + required: false env: GOPRIVATE: ${{ inputs.GOPRIVATE }} jobs: @@ -82,21 +100,48 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - # Use auth to get access to private Git repos for Go code dependencies. + - name: Login to Artifact Registry + env: + ARTIFACT_REGISTRY_JSON_KEY: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} + if: ${{ env.ARTIFACT_REGISTRY_JSON_KEY }} + uses: docker/login-action@v2 + with: + registry: ${{ secrets.ARTIFACT_REGISTRY }} + username: _json_key + password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} - name: Configure git for private modules env: TOKEN: ${{ secrets.GH_CI_PAT }} GITHUB_USERNAME: ${{ inputs.GH_CI_USER }} - run: git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf + run: + git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf "https://github.com" + # Vendor Go code needed to build app. + - name: go mod vendor + run: go mod vendor | go work vendor # Go vet every Go module. - name: go vet - run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname - | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." + run: + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." # Run unit test for evet Go module. + - name: build coverage output directories + run: | + mkdir -p coverage/unit + mkdir -p coverage/int - name: go test - run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname - | xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." + run: + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" + # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int + # to seperate out any integration tests + - name: integration tests + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} + run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... + - name: show coverage output directories + run: | + ls ./coverage/unit + ls ./coverage/int + - name: build coverage.txt + run: go tool covdata textfmt -i=./coverage/int,./coverage/unit -o coverage.txt - name: Upload test coverage results to Codecov uses: codecov/codecov-action@v4 with: From bb9f953e193a9eb4aca6fd5cdf2f19e44eb043ba Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Wed, 12 Mar 2025 11:46:50 -0600 Subject: [PATCH 10/21] chore: support integration tests for go_app_pull_requests.yml --- .github/workflows/go_app_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index f74f811..1b16d6b 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -118,7 +118,7 @@ jobs: "https://github.com" # Vendor Go code needed to build app. - name: go mod vendor - run: go mod vendor | go work vendor + run: go mod vendor # Go vet every Go module. - name: go vet run: From af13502ac75cbb4cdd892addaa139e653003bef3 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Mar 2025 08:36:59 -0600 Subject: [PATCH 11/21] fix: have go app push_main run integration tests --- .github/workflows/go_app_push_main.yml | 56 +++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go_app_push_main.yml b/.github/workflows/go_app_push_main.yml index 340c6c4..8d8db66 100644 --- a/.github/workflows/go_app_push_main.yml +++ b/.github/workflows/go_app_push_main.yml @@ -11,6 +11,18 @@ on: description: "GOPRIVATE env for go commands" required: false type: string + GO_TEST_UNIT_TAGS: + description: "The tags flag for the unit test go test call. Include -tags flag. Example -tags=unit" + type: string + required: false + default: "" + GO_TEST_INTEGRATION_ENABLED: + type: boolean + default: false + GO_TEST_INTEGRATION_TAGS: + description: "The tags flag for the integration test go test call. Include -tags flag. Example -tags=integration" + type: string + default: "-tags=integration" secrets: GH_CI_PAT: description: 'Token password for GitHub auth' @@ -18,6 +30,12 @@ on: CODECOV_TOKEN: description: 'Token for Codecov' required: true + ARTIFACT_REGISTRY: + description: 'Artifact Registry address to which to publish (leave blank to not publish)' + required: false + ARTIFACT_REGISTRY_JSON_KEY: + description: 'Key for publishing to Artifact Registry' + required: false env: GOPRIVATE: ${{ inputs.GOPRIVATE }} jobs: @@ -39,6 +57,15 @@ jobs: uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} + - name: Login to Artifact Registry + env: + ARTIFACT_REGISTRY_JSON_KEY: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} + if: ${{ env.ARTIFACT_REGISTRY_JSON_KEY }} + uses: docker/login-action@v2 + with: + registry: ${{ secrets.ARTIFACT_REGISTRY }} + username: _json_key + password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} # Use auth to get access to private Git repos for Go code dependencies. - name: Configure git for private modules env: @@ -46,14 +73,31 @@ jobs: GITHUB_USERNAME: ${{ inputs.GH_CI_USER }} run: git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf "https://github.com" + # Vendor Go code needed to build app. + - name: go mod vendor + run: go mod vendor # Go vet every Go module. - name: go vet - run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname - | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." - # Run unit test for evet Go module. - - name: go test - run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname - | xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." + run: + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." + - name: build coverage output directories + run: | + mkdir -p coverage/unit + mkdir -p coverage/int + - name: go test + run: + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" + # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int + # to seperate out any integration tests + - name: integration tests + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} + run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... + - name: show coverage output directories + run: | + ls ./coverage/unit + ls ./coverage/int + - name: build coverage.txt + run: go tool covdata textfmt -i=./coverage/int,./coverage/unit -o coverage.txt - name: Upload test coverage results to Codecov uses: codecov/codecov-action@v4 with: From d7f1e06fc28fced14fcf883e36091e7081418b4a Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Fri, 14 Mar 2025 08:47:41 -0600 Subject: [PATCH 12/21] chore: correct indentation --- .github/workflows/go_app_push_main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go_app_push_main.yml b/.github/workflows/go_app_push_main.yml index 8d8db66..e6e0f1a 100644 --- a/.github/workflows/go_app_push_main.yml +++ b/.github/workflows/go_app_push_main.yml @@ -84,9 +84,9 @@ jobs: run: | mkdir -p coverage/unit mkdir -p coverage/int - - name: go test - run: - find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" + - name: go test + run: + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests From 90bd2f2b482b3228dd482acb046dc0cbd979203d Mon Sep 17 00:00:00 2001 From: Cesar Date: Tue, 20 May 2025 15:05:51 +0200 Subject: [PATCH 13/21] feat: add junit report --- .github/workflows/go_app_pull_requests.yml | 14 ++++++++++++++ .github/workflows/go_app_push_main.yml | 14 ++++++++++++++ .github/workflows/go_lib_pull_requests.yml | 14 ++++++++++++++ .github/workflows/go_lib_push_main.yml | 14 ++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 1b16d6b..28d26e0 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -131,6 +131,20 @@ jobs: - name: go test run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" + | go-junit-report -set-exit-code > junit_report.xml || true + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test Report + path: junit_report.xml + reporter: java-junit + - uses: codecov/test-results-action@v1 + with: + fail_ci_if_error: true # optional (default = false) + files: ./junit_report.xml + name: junit-report + token: ${{ secrets.CODECOV_TOKEN }} # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests diff --git a/.github/workflows/go_app_push_main.yml b/.github/workflows/go_app_push_main.yml index e6e0f1a..f44166c 100644 --- a/.github/workflows/go_app_push_main.yml +++ b/.github/workflows/go_app_push_main.yml @@ -87,6 +87,20 @@ jobs: - name: go test run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" + | go-junit-report -set-exit-code > junit_report.xml || true + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test Report + path: junit_report.xml + reporter: java-junit + - uses: codecov/test-results-action@v1 + with: + fail_ci_if_error: true # optional (default = false) + files: ./junit_report.xml + name: junit-report + token: ${{ secrets.CODECOV_TOKEN }} # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index a838add..b524ec3 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -131,6 +131,20 @@ jobs: - name: go vet run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." + | go-junit-report -set-exit-code > junit_report.xml || true + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test Report + path: junit_report.xml + reporter: java-junit + - uses: codecov/test-results-action@v1 + with: + fail_ci_if_error: true # optional (default = false) + files: ./junit_report.xml + name: junit-report + token: ${{ secrets.CODECOV_TOKEN }} # Run unit test for evet Go module. - name: build coverage output directories run: | diff --git a/.github/workflows/go_lib_push_main.yml b/.github/workflows/go_lib_push_main.yml index 4152d1e..a54122b 100644 --- a/.github/workflows/go_lib_push_main.yml +++ b/.github/workflows/go_lib_push_main.yml @@ -57,6 +57,20 @@ jobs: run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." + | go-junit-report -set-exit-code > junit_report.xml || true + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test Report + path: junit_report.xml + reporter: java-junit + - uses: codecov/test-results-action@v1 + with: + fail_ci_if_error: true # optional (default = false) + files: ./junit_report.xml + name: junit-report + token: ${{ secrets.CODECOV_TOKEN }} - name: Upload test coverage results to Codecov uses: codecov/codecov-action@v4 with: From 25d1fe059797e14a9a80aa3fa4d1ea1af7d08f3a Mon Sep 17 00:00:00 2001 From: Cesar Date: Tue, 20 May 2025 15:16:10 +0200 Subject: [PATCH 14/21] feat: add junit test report --- .github/workflows/go_app_pull_requests.yml | 10 ++++-- .github/workflows/go_app_push_main.yml | 25 +++++++++++-- .github/workflows/go_lib_pull_requests.yml | 42 ++++++++++++++++------ .github/workflows/go_lib_push_main.yml | 10 ++++-- 4 files changed, 67 insertions(+), 20 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 28d26e0..3bb8edf 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -123,6 +123,9 @@ jobs: - name: go vet run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." + # Install go-junit-report to format test results. + - name: Install go-junit-report + run: go install github.com/jstemmer/go-junit-report@v2.1.0 # Run unit test for evet Go module. - name: build coverage output directories run: | @@ -132,14 +135,15 @@ jobs: run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" | go-junit-report -set-exit-code > junit_report.xml || true - - name: Test Report + - name: Unit Test Report uses: dorny/test-reporter@v1 if: success() || failure() with: - name: Test Report + name: Unit Test Report path: junit_report.xml reporter: java-junit - - uses: codecov/test-results-action@v1 + - name: Upload unit test coverage results to Codecov + uses: codecov/test-results-action@v1 with: fail_ci_if_error: true # optional (default = false) files: ./junit_report.xml diff --git a/.github/workflows/go_app_push_main.yml b/.github/workflows/go_app_push_main.yml index f44166c..39ef1c5 100644 --- a/.github/workflows/go_app_push_main.yml +++ b/.github/workflows/go_app_push_main.yml @@ -80,6 +80,9 @@ jobs: - name: go vet run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." + # Install go-junit-report to format test results. + - name: Install go-junit-report + run: go install github.com/jstemmer/go-junit-report@v2.1.0 - name: build coverage output directories run: | mkdir -p coverage/unit @@ -88,14 +91,15 @@ jobs: run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" | go-junit-report -set-exit-code > junit_report.xml || true - - name: Test Report + - name: Unit Test Report uses: dorny/test-reporter@v1 if: success() || failure() with: - name: Test Report + name: Unit Test Report path: junit_report.xml reporter: java-junit - - uses: codecov/test-results-action@v1 + - name: Upload unit test coverage results to Codecov + uses: codecov/test-results-action@v1 with: fail_ci_if_error: true # optional (default = false) files: ./junit_report.xml @@ -106,6 +110,7 @@ jobs: - name: integration tests if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... + | go-junit-report -set-exit-code > junit_integration_report.xml || true - name: show coverage output directories run: | ls ./coverage/unit @@ -116,6 +121,20 @@ jobs: uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} + - name: Integration Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Integration Test Report + path: junit_integration_report.xml + reporter: java-junit + - name: Upload integration test coverage results to Codecov + uses: codecov/test-results-action@v1 + with: + fail_ci_if_error: true # optional (default = false) + files: ./junit_report.xml + name: junit-report + token: ${{ secrets.CODECOV_TOKEN }} release: # # Create a GitHub Release based on conventional commits. diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index b524ec3..eadd04c 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -132,32 +132,38 @@ jobs: run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." | go-junit-report -set-exit-code > junit_report.xml || true - - name: Test Report + # Install go-junit-report to format test results. + - name: Install go-junit-report + run: go install github.com/jstemmer/go-junit-report@v2.1.0 + # Run unit test for evet Go module. + - name: build coverage output directories + run: | + mkdir -p coverage/unit + mkdir -p coverage/int + - name: go test + run: + find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" + | go-junit-report -set-exit-code > junit_report.xml || true + - name: Unit Test Report uses: dorny/test-reporter@v1 if: success() || failure() with: - name: Test Report + name: Unit Test Report path: junit_report.xml reporter: java-junit - - uses: codecov/test-results-action@v1 + - name: Upload unit test coverage results to Codecov + uses: codecov/test-results-action@v1 with: fail_ci_if_error: true # optional (default = false) files: ./junit_report.xml name: junit-report token: ${{ secrets.CODECOV_TOKEN }} - # Run unit test for evet Go module. - - name: build coverage output directories - run: | - mkdir -p coverage/unit - mkdir -p coverage/int - - name: go test - run: - find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" # relies on the tests themselves compiling the binary with `-cover` and setting GOCOVERDIR to /coverage/int # to seperate out any integration tests - name: integration tests if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... + | go-junit-report -set-exit-code > junit_integration_report.xml || true - name: show coverage output directories run: | ls ./coverage/unit @@ -167,4 +173,18 @@ jobs: - name: Upload test coverage results to Codecov uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Integration Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Integration Test Report + path: junit_integration_report.xml + reporter: java-junit + - name: Upload integration test coverage results to Codecov + uses: codecov/test-results-action@v1 + with: + fail_ci_if_error: true # optional (default = false) + files: ./junit_report.xml + name: junit-report token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/go_lib_push_main.yml b/.github/workflows/go_lib_push_main.yml index a54122b..3c0d7c6 100644 --- a/.github/workflows/go_lib_push_main.yml +++ b/.github/workflows/go_lib_push_main.yml @@ -52,20 +52,24 @@ jobs: run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." + # Install go-junit-report to format test results. + - name: Install go-junit-report + run: go install github.com/jstemmer/go-junit-report@v2.1.0 # Run unit test for evet Go module. - name: go test run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." | go-junit-report -set-exit-code > junit_report.xml || true - - name: Test Report + - name: Unit Test Report uses: dorny/test-reporter@v1 if: success() || failure() with: - name: Test Report + name: Unit Test Report path: junit_report.xml reporter: java-junit - - uses: codecov/test-results-action@v1 + - name: Upload unit test coverage results to Codecov + uses: codecov/test-results-action@v1 with: fail_ci_if_error: true # optional (default = false) files: ./junit_report.xml From 313711b2c53bd4f1663f6828f21e36a33e00a324 Mon Sep 17 00:00:00 2001 From: Cesar Date: Wed, 21 May 2025 16:20:58 +0200 Subject: [PATCH 15/21] fix: use proper version --- .github/workflows/go_app_pull_requests.yml | 2 +- .github/workflows/go_app_push_main.yml | 2 +- .github/workflows/go_lib_pull_requests.yml | 2 +- .github/workflows/go_lib_push_main.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 3bb8edf..2bd0a53 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -125,7 +125,7 @@ jobs: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." # Install go-junit-report to format test results. - name: Install go-junit-report - run: go install github.com/jstemmer/go-junit-report@v2.1.0 + run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0 # Run unit test for evet Go module. - name: build coverage output directories run: | diff --git a/.github/workflows/go_app_push_main.yml b/.github/workflows/go_app_push_main.yml index 39ef1c5..a24ecf7 100644 --- a/.github/workflows/go_app_push_main.yml +++ b/.github/workflows/go_app_push_main.yml @@ -82,7 +82,7 @@ jobs: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." # Install go-junit-report to format test results. - name: Install go-junit-report - run: go install github.com/jstemmer/go-junit-report@v2.1.0 + run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0 - name: build coverage output directories run: | mkdir -p coverage/unit diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index eadd04c..9704416 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -134,7 +134,7 @@ jobs: | go-junit-report -set-exit-code > junit_report.xml || true # Install go-junit-report to format test results. - name: Install go-junit-report - run: go install github.com/jstemmer/go-junit-report@v2.1.0 + run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0 # Run unit test for evet Go module. - name: build coverage output directories run: | diff --git a/.github/workflows/go_lib_push_main.yml b/.github/workflows/go_lib_push_main.yml index 3c0d7c6..1993fd5 100644 --- a/.github/workflows/go_lib_push_main.yml +++ b/.github/workflows/go_lib_push_main.yml @@ -54,7 +54,7 @@ jobs: | xargs -n1 -I{} bash -c "pushd {}; go vet ./..." # Install go-junit-report to format test results. - name: Install go-junit-report - run: go install github.com/jstemmer/go-junit-report@v2.1.0 + run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0 # Run unit test for evet Go module. - name: go test run: From 3ccc4e9886b96b4ab93e113074b16e566d81cedf Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Wed, 4 Jun 2025 14:51:04 -0600 Subject: [PATCH 16/21] fix: show test output --- .github/workflows/go_app_push_main.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go_app_push_main.yml b/.github/workflows/go_app_push_main.yml index a24ecf7..b2d42ec 100644 --- a/.github/workflows/go_app_push_main.yml +++ b/.github/workflows/go_app_push_main.yml @@ -90,7 +90,10 @@ jobs: - name: go test run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" - | go-junit-report -set-exit-code > junit_report.xml || true + | tee unit_test_output.txt + - name: Build Unit Test Junit report + run: + go-junit-report -in unit_test_output.txt -set-exit-code > junit_report.xml || true - name: Unit Test Report uses: dorny/test-reporter@v1 if: success() || failure() @@ -98,7 +101,7 @@ jobs: name: Unit Test Report path: junit_report.xml reporter: java-junit - - name: Upload unit test coverage results to Codecov + - name: Upload unit test results to Codecov uses: codecov/test-results-action@v1 with: fail_ci_if_error: true # optional (default = false) @@ -110,7 +113,9 @@ jobs: - name: integration tests if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... - | go-junit-report -set-exit-code > junit_integration_report.xml || true + | tee integration_test_output.txt + - name: Build Integration Test Junit report + run: go-junit-report -in integration_test_output.txt -set-exit-code > junit_integration_report.xml || true - name: show coverage output directories run: | ls ./coverage/unit @@ -128,7 +133,7 @@ jobs: name: Integration Test Report path: junit_integration_report.xml reporter: java-junit - - name: Upload integration test coverage results to Codecov + - name: Upload integration test results to Codecov uses: codecov/test-results-action@v1 with: fail_ci_if_error: true # optional (default = false) From e4bbecceafd91d83baa387b51848d15f40ca8398 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Wed, 4 Jun 2025 14:59:34 -0600 Subject: [PATCH 17/21] fix: report junit results for integration tests during prs --- .github/workflows/go_app_pull_requests.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 2bd0a53..36d8c57 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -134,7 +134,10 @@ jobs: - name: go test run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname | xargs -n1 -I{} bash -c "pushd {}; go test -cover --race -v ${{ inputs.GO_TEST_UNIT_TAGS }} ./... -args -test.gocoverdir=\"${{ github.workspace }}/coverage/unit\"" - | go-junit-report -set-exit-code > junit_report.xml || true + | tee unit_test_output.txt + - name: Build Unit Test Junit report + run: + go-junit-report -in unit_test_output.txt -set-exit-code > junit_report.xml || true - name: Unit Test Report uses: dorny/test-reporter@v1 if: success() || failure() @@ -154,6 +157,16 @@ jobs: - name: integration tests if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... + | tee integration_test_output.txt + - name: Build Integration Test Junit report + run: go-junit-report -in integration_test_output.txt -set-exit-code > junit_integration_report.xml || true + - name: Integration Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Integration Test Report + path: junit_integration_report.xml + reporter: java-junit - name: show coverage output directories run: | ls ./coverage/unit From 08a397af6b1016d2759e250a71764cf877e69066 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Mon, 30 Jun 2025 13:21:03 -0700 Subject: [PATCH 18/21] chore: merge main into branch --- .github/workflows/base_app_release.yml | 27 +------------------- .github/workflows/go_app_release.yml | 27 +------------------- .github/workflows/gradle_jvm_app_release.yml | 27 +------------------- .github/workflows/ruby_app_release.yml | 27 +------------------- .gitignore | 1 + 5 files changed, 5 insertions(+), 104 deletions(-) create mode 100644 .gitignore diff --git a/.github/workflows/base_app_release.yml b/.github/workflows/base_app_release.yml index 9142873..6e8d269 100644 --- a/.github/workflows/base_app_release.yml +++ b/.github/workflows/base_app_release.yml @@ -22,13 +22,6 @@ on: ARTIFACT_REGISTRY_JSON_KEY: description: 'Key for publishing to Artifact Registry' required: false - # Container Registry arguements - CONTAINER_REGISTRY: - description: 'Container Registry address to which to publish (leave blank to not publish)' - required: false - CONTAINER_REGISTRY_JSON_KEY: - description: 'Key for publishing to Container Registry' - required: false jobs: push: @@ -52,13 +45,6 @@ jobs: if: ${{ env.ARTIFACT_REGISTRY }} run: | echo "ARTIFACT_REGISTRY_IMAGE_NAME=${{ secrets.ARTIFACT_REGISTRY }}/${{ github.repository }}" >> $GITHUB_ENV - # Make the docker fields for Container Registry if we're pushing to it. - - name: Construct Container Registry fields - env: - CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }} - if: ${{ env.CONTAINER_REGISTRY }} - run: | - echo "CONTAINER_REGISTRY_IMAGE_NAME=${{ secrets.CONTAINER_REGISTRY }}/${{ steps.parse_repo_name.outputs.repo_name }}" >> $GITHUB_ENV # Create docker image meta data. Docker tags include the Git tag itself and the sematic version parsing of that tag if possible. - name: Docker release meta id: release @@ -66,7 +52,6 @@ jobs: with: images: | ${{ env.ARTIFACT_REGISTRY_IMAGE_NAME }} - ${{ env.CONTAINER_REGISTRY_IMAGE_NAME }} flavor: | latest=false tags: | @@ -82,16 +67,6 @@ jobs: registry: ${{ secrets.ARTIFACT_REGISTRY }} username: _json_key password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} - # Login to Container Registry if we're pushing to it. - - name: Login to Container Registry - env: - CONTAINER_REGISTRY_JSON_KEY: ${{ secrets.CONTAINER_REGISTRY_JSON_KEY }} - if: ${{ env.CONTAINER_REGISTRY_JSON_KEY }} - uses: docker/login-action@v2 - with: - registry: ${{ secrets.CONTAINER_REGISTRY }} - username: _json_key - password: ${{ secrets.CONTAINER_REGISTRY_JSON_KEY }} # Setup QEMU needed to build arm64 images. - name: Setup QEMU uses: docker/setup-qemu-action@v2 @@ -100,7 +75,7 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2 # Build and push the image. - - name: Build and Push to Artifact Registry and Container Registry + - name: Build and Push to Artifact Registry uses: docker/build-push-action@v3 with: push: true diff --git a/.github/workflows/go_app_release.yml b/.github/workflows/go_app_release.yml index e786380..b9eb411 100644 --- a/.github/workflows/go_app_release.yml +++ b/.github/workflows/go_app_release.yml @@ -26,13 +26,6 @@ on: ARTIFACT_REGISTRY_JSON_KEY: description: 'Key for publishing to Artifact Registry' required: false - # Container Registry arguements - CONTAINER_REGISTRY: - description: 'Container Registry address to which to publish (leave blank to not publish)' - required: false - CONTAINER_REGISTRY_JSON_KEY: - description: 'Key for publishing to Container Registry' - required: false env: GOPRIVATE: ${{ inputs.GOPRIVATE }} @@ -72,13 +65,6 @@ jobs: if: ${{ env.ARTIFACT_REGISTRY }} run: | echo "ARTIFACT_REGISTRY_IMAGE_NAME=${{ secrets.ARTIFACT_REGISTRY }}/${{ github.repository }}" >> $GITHUB_ENV - # Make the docker fields for Container Registry if we're pushing to it. - - name: Construct Container Registry fields - env: - CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }} - if: ${{ env.CONTAINER_REGISTRY }} - run: | - echo "CONTAINER_REGISTRY_IMAGE_NAME=${{ secrets.CONTAINER_REGISTRY }}/${{ steps.parse_repo_name.outputs.repo_name }}" >> $GITHUB_ENV # Create docker image meta data. Docker tags include the Git tag itself and the sematic version parsing of that tag if possible. - name: Docker release meta id: release @@ -86,7 +72,6 @@ jobs: with: images: | ${{ env.ARTIFACT_REGISTRY_IMAGE_NAME }} - ${{ env.CONTAINER_REGISTRY_IMAGE_NAME }} flavor: | latest=false tags: | @@ -102,16 +87,6 @@ jobs: registry: ${{ secrets.ARTIFACT_REGISTRY }} username: _json_key password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} - # Login to Container Registry if we're pushing to it. - - name: Login to Container Registry - env: - CONTAINER_REGISTRY_JSON_KEY: ${{ secrets.CONTAINER_REGISTRY_JSON_KEY }} - if: ${{ env.CONTAINER_REGISTRY_JSON_KEY }} - uses: docker/login-action@v2 - with: - registry: ${{ secrets.CONTAINER_REGISTRY }} - username: _json_key - password: ${{ secrets.CONTAINER_REGISTRY_JSON_KEY }} # Setup QEMU needed to build arm64 images. - name: Setup QEMU uses: docker/setup-qemu-action@v2 @@ -120,7 +95,7 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2 # Build and push the image. - - name: Build and Push to Artifact Registry and Container Registry + - name: Build and Push to Artifact Registry uses: docker/build-push-action@v3 with: push: true diff --git a/.github/workflows/gradle_jvm_app_release.yml b/.github/workflows/gradle_jvm_app_release.yml index 338706b..d9db90a 100644 --- a/.github/workflows/gradle_jvm_app_release.yml +++ b/.github/workflows/gradle_jvm_app_release.yml @@ -26,13 +26,6 @@ on: ARTIFACT_REGISTRY_JSON_KEY: description: 'Key for publishing to Artifact Registry' required: false - # Container Registry arguements - CONTAINER_REGISTRY: - description: 'Container Registry address to which to publish (leave blank to not publish)' - required: false - CONTAINER_REGISTRY_JSON_KEY: - description: 'Key for publishing to Container Registry' - required: false env: GOPRIVATE: ${{ inputs.GOPRIVATE }} @@ -66,13 +59,6 @@ jobs: if: ${{ env.ARTIFACT_REGISTRY }} run: | echo "ARTIFACT_REGISTRY_IMAGE_NAME=${{ secrets.ARTIFACT_REGISTRY }}/${{ github.repository }}" >> $GITHUB_ENV - # Make the docker fields for Container Registry if we're pushing to it. - - name: Construct Container Registry fields - env: - CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }} - if: ${{ env.CONTAINER_REGISTRY }} - run: | - echo "CONTAINER_REGISTRY_IMAGE_NAME=${{ secrets.CONTAINER_REGISTRY }}/${{ steps.parse_repo_name.outputs.repo_name }}" >> $GITHUB_ENV # Create docker image meta data. Docker tags include the Git tag itself and the sematic version parsing of that tag if possible. - name: Docker release meta id: release @@ -80,7 +66,6 @@ jobs: with: images: | ${{ env.ARTIFACT_REGISTRY_IMAGE_NAME }} - ${{ env.CONTAINER_REGISTRY_IMAGE_NAME }} flavor: | latest=false tags: | @@ -96,16 +81,6 @@ jobs: registry: ${{ secrets.ARTIFACT_REGISTRY }} username: _json_key password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} - # Login to Container Registry if we're pushing to it. - - name: Login to Container Registry - env: - CONTAINER_REGISTRY_JSON_KEY: ${{ secrets.CONTAINER_REGISTRY_JSON_KEY }} - if: ${{ env.CONTAINER_REGISTRY_JSON_KEY }} - uses: docker/login-action@v2 - with: - registry: ${{ secrets.CONTAINER_REGISTRY }} - username: _json_key - password: ${{ secrets.CONTAINER_REGISTRY_JSON_KEY }} # Setup QEMU needed to build arm64 images. - name: Setup QEMU uses: docker/setup-qemu-action@v2 @@ -114,7 +89,7 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2 # Build and push the image. - - name: Build and Push to Artifact Registry and Container Registry + - name: Build and Push to Artifact Registry uses: docker/build-push-action@v3 with: push: true diff --git a/.github/workflows/ruby_app_release.yml b/.github/workflows/ruby_app_release.yml index 15faa96..cb87008 100644 --- a/.github/workflows/ruby_app_release.yml +++ b/.github/workflows/ruby_app_release.yml @@ -13,13 +13,6 @@ on: ARTIFACT_REGISTRY_JSON_KEY: description: 'Key for publishing to Artifact Registry' required: false - # Container Registry arguments - CONTAINER_REGISTRY: - description: 'Container Registry address to which to publish (leave blank to not publish)' - required: false - CONTAINER_REGISTRY_JSON_KEY: - description: 'Key for publishing to Container Registry' - required: false jobs: push: @@ -42,13 +35,6 @@ jobs: if: ${{ env.ARTIFACT_REGISTRY }} run: | echo "ARTIFACT_REGISTRY_IMAGE_NAME=${{ secrets.ARTIFACT_REGISTRY }}/${{ github.repository }}" >> $GITHUB_ENV - # Make the docker fields for Container Registry if we're pushing to it. - - name: Construct Container Registry fields - env: - CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }} - if: ${{ env.CONTAINER_REGISTRY }} - run: | - echo "CONTAINER_REGISTRY_IMAGE_NAME=${{ secrets.CONTAINER_REGISTRY }}/${{ steps.parse_repo_name.outputs.repo_name }}" >> $GITHUB_ENV # Create docker image meta data. Docker tags include the Git tag itself and the sematic version parsing of that tag if possible. - name: Docker release meta id: release @@ -56,7 +42,6 @@ jobs: with: images: | ${{ env.ARTIFACT_REGISTRY_IMAGE_NAME }} - ${{ env.CONTAINER_REGISTRY_IMAGE_NAME }} flavor: | latest=false tags: | @@ -72,22 +57,12 @@ jobs: registry: ${{ secrets.ARTIFACT_REGISTRY }} username: _json_key password: ${{ secrets.ARTIFACT_REGISTRY_JSON_KEY }} - # Login to Container Registry if we're pushing to it. - - name: Login to Container Registry - env: - CONTAINER_REGISTRY_JSON_KEY: ${{ secrets.CONTAINER_REGISTRY_JSON_KEY }} - if: ${{ env.CONTAINER_REGISTRY_JSON_KEY }} - uses: docker/login-action@v2 - with: - registry: ${{ secrets.CONTAINER_REGISTRY }} - username: _json_key - password: ${{ secrets.CONTAINER_REGISTRY_JSON_KEY }} # Setup Docker builder needed to build multi-architectural images. - name: Setup Docker Buildx id: buildx uses: docker/setup-buildx-action@v2 # Build and push the image. - - name: Build and Push to Artifact Registry and Container Registry + - name: Build and Push to Artifact Registry uses: docker/build-push-action@v3 with: push: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea From b2e279fc7cc18193482612fbf1057c1e45d97070 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Tue, 1 Jul 2025 11:57:07 -0700 Subject: [PATCH 19/21] chore: skip more integration test steps if disabled --- .github/workflows/go_app_pull_requests.yml | 3 ++- .github/workflows/go_app_push_main.yml | 1 + .github/workflows/go_lib_pull_requests.yml | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 36d8c57..b34b45d 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -159,10 +159,11 @@ jobs: run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... | tee integration_test_output.txt - name: Build Integration Test Junit report + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} run: go-junit-report -in integration_test_output.txt -set-exit-code > junit_integration_report.xml || true - name: Integration Test Report uses: dorny/test-reporter@v1 - if: success() || failure() + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} with: name: Integration Test Report path: junit_integration_report.xml diff --git a/.github/workflows/go_app_push_main.yml b/.github/workflows/go_app_push_main.yml index b2d42ec..1ede77e 100644 --- a/.github/workflows/go_app_push_main.yml +++ b/.github/workflows/go_app_push_main.yml @@ -115,6 +115,7 @@ jobs: run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... | tee integration_test_output.txt - name: Build Integration Test Junit report + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} run: go-junit-report -in integration_test_output.txt -set-exit-code > junit_integration_report.xml || true - name: show coverage output directories run: | diff --git a/.github/workflows/go_lib_pull_requests.yml b/.github/workflows/go_lib_pull_requests.yml index 9704416..71885ec 100644 --- a/.github/workflows/go_lib_pull_requests.yml +++ b/.github/workflows/go_lib_pull_requests.yml @@ -176,12 +176,13 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Integration Test Report uses: dorny/test-reporter@v1 - if: success() || failure() + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} with: name: Integration Test Report path: junit_integration_report.xml reporter: java-junit - name: Upload integration test coverage results to Codecov + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} uses: codecov/test-results-action@v1 with: fail_ci_if_error: true # optional (default = false) From e3131b058ab685a0481e508a9b3800844c81b566 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Wed, 16 Jul 2025 10:42:34 -0600 Subject: [PATCH 20/21] fix: add integration test timeout --- .github/workflows/go_app_pull_requests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index b34b45d..664cedd 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -22,6 +22,10 @@ on: description: "The tags flag for the integration test go test call. Include -tags flag. Example -tags=integration" type: string default: "-tags=integration" + GO_TEST_INTEGRATION_TIMEOUT: + description: "The duration before tests are stopped" + type: string + default: "10m" secrets: GH_CI_PAT: description: 'Token password for GitHub auth' @@ -156,7 +160,7 @@ jobs: # to seperate out any integration tests - name: integration tests if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} - run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} ./... + run: go test -v ${{ inputs.GO_TEST_INTEGRATION_TAGS }} -timeout ${{ inputs.GO_TEST_INTEGRATION_TIMEOUT }} ./... | tee integration_test_output.txt - name: Build Integration Test Junit report if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} From 7999a48f41f0abd8e7d13fb7e3bc80b46c9a094e Mon Sep 17 00:00:00 2001 From: Cesar Date: Fri, 28 Nov 2025 13:33:32 +0100 Subject: [PATCH 21/21] chore: add verbose mode, push integration test report to codecov --- .github/workflows/go_app_pull_requests.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/go_app_pull_requests.yml b/.github/workflows/go_app_pull_requests.yml index 664cedd..6e66d89 100644 --- a/.github/workflows/go_app_pull_requests.yml +++ b/.github/workflows/go_app_pull_requests.yml @@ -172,6 +172,14 @@ jobs: name: Integration Test Report path: junit_integration_report.xml reporter: java-junit + - name: Upload integration test results to Codecov + if: ${{ inputs.GO_TEST_INTEGRATION_ENABLED }} + uses: codecov/test-results-action@v1 + with: + fail_ci_if_error: true # optional (default = false) + files: ./junit_integration_report.xml + name: junit-integration-report + token: ${{ secrets.CODECOV_TOKEN }} - name: show coverage output directories run: | ls ./coverage/unit @@ -182,6 +190,9 @@ jobs: uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.txt + verbose: true + fail_ci_if_error: true # optional (default = false) docker-build: # # ensures the docker image will build without pushing to the registry