Merge pull request #2 from innogames/dependabot/go_modules/golang.org… #7
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, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: stable | |
| - name: Run tests | |
| run: go test ./... | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: stable | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Build for multiple platforms | |
| run: | | |
| mkdir -p bin | |
| # Build for Linux AMD64 | |
| GOOS=linux GOARCH=amd64 go build -o bin/serveradmin-go-linux-amd64 . | |
| # Build for Linux ARM64 | |
| GOOS=linux GOARCH=arm64 go build -o bin/serveradmin-go-linux-arm64 . | |
| # Build for Windows AMD64 | |
| GOOS=windows GOARCH=amd64 go build -o bin/serveradmin-go-windows-amd64.exe . | |
| # Build for macOS AMD64 | |
| GOOS=darwin GOARCH=amd64 go build -o bin/serveradmin-go-darwin-amd64 . | |
| # Build for macOS ARM64 (Apple Silicon) | |
| GOOS=darwin GOARCH=arm64 go build -o bin/serveradmin-go-darwin-arm64 . | |
| format-check: | |
| name: Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: stable | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: latest | |
| - name: Check go mod tidy | |
| run: | | |
| go mod tidy | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "go.mod or go.sum is not tidy. Please run 'go mod tidy'" | |
| git status | |
| exit 1 | |
| fi |