File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9595 - name : Fail if tests failed
9696 if : always() && steps.pytest.outputs.exit_code != '0'
9797 run : exit 1
98+
99+ run-go-tests :
100+ name : Run Go tests
101+ runs-on : [self-hosted, rune-ci]
102+ steps :
103+ - uses : actions/checkout@v4
104+
105+ # Skip silently when go.mod is absent (Python-only branches before the
106+ # Go migration lands on main). Subsequent steps gate on this output.
107+ - name : Detect Go project
108+ id : detect_go
109+ run : |
110+ if [ -f go.mod ]; then
111+ echo "has_go=true" >> "$GITHUB_OUTPUT"
112+ else
113+ echo "has_go=false" >> "$GITHUB_OUTPUT"
114+ echo "::notice::No go.mod found — skipping Go tests"
115+ fi
116+
117+ - uses : actions/setup-go@v5
118+ if : steps.detect_go.outputs.has_go == 'true'
119+ with :
120+ go-version-file : ' go.mod'
121+ cache : true
122+
123+ - name : gofmt
124+ if : steps.detect_go.outputs.has_go == 'true'
125+ run : |
126+ unformatted=$(gofmt -l -e .)
127+ if [ -n "$unformatted" ]; then
128+ echo "::error::gofmt found unformatted files:"
129+ echo "$unformatted"
130+ gofmt -d -e .
131+ exit 1
132+ fi
133+
134+ - name : go vet
135+ if : steps.detect_go.outputs.has_go == 'true'
136+ run : go vet ./...
137+
138+ - name : go test -race
139+ if : steps.detect_go.outputs.has_go == 'true'
140+ run : go test -race -count=1 ./...
You can’t perform that action at this time.
0 commit comments