From 7e37d6422e13936fd2bf5c65c841308b9e30c2ac Mon Sep 17 00:00:00 2001 From: couragehong Date: Mon, 27 Apr 2026 11:23:51 +0900 Subject: [PATCH 1/3] ci: add Go test job (skips when go.mod absent) --- .github/workflows/pr-tests.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 09bb22a..c8ea159 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -95,3 +95,31 @@ jobs: - name: Fail if tests failed if: always() && steps.pytest.outputs.exit_code != '0' run: exit 1 + + run-go-tests: + name: Run Go tests + runs-on: [self-hosted, rune-ci] + steps: + - uses: actions/checkout@v4 + + # Skip silently when go.mod is absent (Python-only branches before the + # Go migration lands on main). Subsequent steps gate on this output. + - name: Detect Go project + id: detect_go + run: | + if [ -f go.mod ]; then + echo "has_go=true" >> "$GITHUB_OUTPUT" + else + echo "has_go=false" >> "$GITHUB_OUTPUT" + echo "::notice::No go.mod found — skipping Go tests" + fi + + - uses: actions/setup-go@v5 + if: steps.detect_go.outputs.has_go == 'true' + with: + go-version-file: 'go.mod' + cache: true + + - name: go test + if: steps.detect_go.outputs.has_go == 'true' + run: go test ./... From 323d29d1f9766ff527ce4d0fa493daf0195f305b Mon Sep 17 00:00:00 2001 From: couragehong Date: Mon, 27 Apr 2026 14:38:30 +0900 Subject: [PATCH 2/3] ci: add gofmt + go vet + race detector to Go test job --- .github/workflows/pr-tests.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index c8ea159..7c82536 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -120,6 +120,21 @@ jobs: go-version-file: 'go.mod' cache: true - - name: go test + - name: gofmt if: steps.detect_go.outputs.has_go == 'true' - run: go test ./... + run: | + unformatted=$(gofmt -l -e .) + if [ -n "$unformatted" ]; then + echo "::error::gofmt found unformatted files:" + echo "$unformatted" + gofmt -d -e . + exit 1 + fi + + - name: go vet + if: steps.detect_go.outputs.has_go == 'true' + run: go vet ./... + + - name: go test -race + if: steps.detect_go.outputs.has_go == 'true' + run: go test -race ./... From 4765a9e64699b36a75cc68e789fb2bfb22dacfc6 Mon Sep 17 00:00:00 2001 From: couragehong Date: Mon, 27 Apr 2026 14:56:04 +0900 Subject: [PATCH 3/3] ci: bypass go test cache via -count=1 --- .github/workflows/pr-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 7c82536..4222ef1 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -137,4 +137,4 @@ jobs: - name: go test -race if: steps.detect_go.outputs.has_go == 'true' - run: go test -race ./... + run: go test -race -count=1 ./...