Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,46 @@ 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: gofmt
if: steps.detect_go.outputs.has_go == 'true'
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 -count=1 ./...
Loading