Traslate code & comments #8
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: CI | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Cache Go modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Download dependencies | |
run: go mod download | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Run go vet | |
run: go vet ./... | |
- name: Run go fmt check | |
run: | | |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | |
echo "Code is not formatted properly:" | |
gofmt -s -l . | |
exit 1 | |
fi | |
- name: Build | |
run: go build -v ./... | |
- name: Test build for multiple platforms | |
run: | | |
GOOS=linux GOARCH=amd64 go build -o /tmp/coderun-linux-amd64 . | |
GOOS=darwin GOARCH=amd64 go build -o /tmp/coderun-darwin-amd64 . | |
GOOS=windows GOARCH=amd64 go build -o /tmp/coderun-windows-amd64.exe . | |
echo "✅ Multi-platform build successful" |