Merge pull request #2327 from mkmccarty/mm-branch-1 #6005
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: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.26' | |
| check-latest: true | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check diff between gofmt and code | |
| run: diff <(gofmt -d .) <(echo -n) | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| go-version: [1.26] | |
| steps: | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run tests | |
| run: go test -v -race ./... | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.26' | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Go vet | |
| run: go vet -x ./... | |
| - name: Golangci-lint | |
| uses: golangci/golangci-lint-action@v8.0.0 | |
| audit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.26' | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Audit | |
| run: make audit | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [format, test, lint, audit] | |
| strategy: | |
| matrix: | |
| go-version: [1.26] | |
| steps: | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Build | |
| run: | | |
| mkdir -p output/{linux,freebsd} | |
| VERSION=$(git describe --tags 2>/dev/null || echo "dev") | |
| CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -X github.com/mkmccarty/TokenTimeBoostBot/version.GitHash=$(git describe --tags --always --long --dirty)" -o output/freebsd/boostbot-$VERSION-freebsd-amd64 | |
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -X github.com/mkmccarty/TokenTimeBoostBot/version.GitHash=$(git describe --tags --always --long --dirty)" -o output/linux/boostbot-$VERSION-linux-amd64 | |
| - name: Upload linux | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: boostbot-linux | |
| path: output/linux | |
| - name: Upload freebsd | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: boostbot-freebsd | |
| path: output/freebsd |