diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..eafced3 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,29 @@ +name: compile+test +on: + push: + branches: + - '**' + pull_request: +jobs: + compile-and-test: + strategy: + matrix: + go-version: [stable] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Setup cache + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v4 + - name: Build and test (no golangci-lint) + run: make build-nolint diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..7299485 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,23 @@ +name: golangci-lint +on: + push: + branches: + - '**' + pull_request: + +permissions: + contents: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.59.1 diff --git a/Makefile b/Makefile index 1d4198d..ab55da9 100644 --- a/Makefile +++ b/Makefile @@ -34,3 +34,7 @@ debug: build: lint test proto-lint generate go build -trimpath -ldflags="-s -w -X 'main.GitCommitHash=$(version)'" +.PHONY: build-nolint +build-nolint: test proto-lint generate + go build -trimpath -ldflags="-s -w -X 'main.GitCommitHash=$(version)'" +