refactor: convert more tests to Go tests (#696) #717
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: './go.mod' | |
| - name: Format Check | |
| run: | | |
| go fmt ./... | |
| if ! git diff --color=always --exit-code -- . ':!vendor'; then | |
| echo "::error::Found changed files after 'go fmt ./...'." | |
| echo "Please run 'go fmt ./...' and check in all changes." | |
| exit 1 | |
| fi | |
| - name: Generate Check | |
| run: | | |
| go generate | |
| if ! git diff --color=always --exit-code -- . ':!vendor'; then | |
| echo "::error::Found changed files after 'go generate'." | |
| echo "Please run 'go generate' and check in all changes." | |
| exit 1 | |
| fi | |
| - name: Build | |
| run: go build -v ./... | |
| - name: Windows Build Test | |
| run: | | |
| GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" | |
| GOOS=windows GOARCH=386 go build -ldflags="-s -w" | |
| GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" | |
| - name: Darwin Build Test | |
| run: | | |
| GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" | |
| GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" | |
| - name: Linux Build Test | |
| run: | | |
| GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" | |
| GOOS=linux GOARCH=386 go build -ldflags="-s -w" | |
| GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" | |
| GOOS=linux GOARCH=riscv64 go build -ldflags="-s -w" | |
| GOOS=linux GOARCH=loong64 go build -ldflags="-s -w" | |
| - name: Test | |
| run: go test -v ./... | |
| - name: Test Race | |
| run: go test -race -v ./... |