name: CI on: push: branches: [main, master] tags: ['v*'] pull_request: permissions: contents: read jobs: test: name: Test (linux/amd64) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: '1.26' cache: true - name: gofmt run: | unformatted="$(gofmt -l .)" if [ -n "$unformatted" ]; then echo "::error::gofmt would modify the following files:" echo "$unformatted" gofmt -d $unformatted exit 1 fi - name: go vet run: go vet ./... - name: go build run: go build ./... - name: go test run: go test -count=1 ./... lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: '1.26' cache: true - uses: golangci/golangci-lint-action@v6 with: version: latest cross-build: name: Cross-build (${{ matrix.goos }}/${{ matrix.goarch }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - goos: linux goarch: amd64 - goos: linux goarch: arm64 - goos: darwin goarch: amd64 - goos: darwin goarch: arm64 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: '1.26' cache: true - name: Build urapt-server env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: '0' run: go build -o /dev/null ./cmd/urapt-server - name: Build urapt CLI env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: '0' run: go build -o /dev/null ./cmd/urapt