Skip to content

Commit

Permalink
Use buf-action in CI (#115)
Browse files Browse the repository at this point in the history
This updates CI to use the new `buf-action` replacing `buf-setup`,
`buf-lint`, `buf-breaking` and `buf-push` unifying these tasks as one.
The new behaviour is as follows:
- On pull requests: run build, lint, format and breaking change
detection checks.
- On push: build and then push the changes of the latest commit with the
label of the current branch (e.g. main).
- On delete: archive the label associated with the delete (e.g. the
branch name of the PR).

Change in behaviour:
- Buf version has been set to `1.32.2`, the current latest release.
- Checks no longer block pushes of commits to the BSR.
- Formatting checks have been added to `buf-ci.yaml`.
- Go version has been bumped to the latest minor release, for
maintenance reasons only.
- Use the setup-go cache for better caching of build artifacts.
  • Loading branch information
emcfarlane authored Jun 4, 2024
1 parent 3a0f505 commit 924b04d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 55 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/buf-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Buf CI
on:
push:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
delete:
permissions:
contents: read
pull-requests: write
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v0.1
with:
token: ${{ secrets.BUF_TOKEN }}
version: 1.32.2
45 changes: 0 additions & 45 deletions .github/workflows/buf.yaml

This file was deleted.

9 changes: 2 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ jobs:
- name: install
uses: actions/setup-go@v5
with:
go-version: 1.21.x
- name: cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-registry-proto-ci-${{ hashFiles('**/Makefile') }}
restore-keys: ${{ runner.os }}-registry-proto-ci-
go-version: 1.22.x
cache-dependency-path: Makefile
- name: make
run: make
- name: make checkgenerate
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BIN := .tmp/bin
export PATH := $(BIN):$(PATH)
export GOBIN := $(abspath $(BIN))

BUF_VERSION := v1.32.0-beta.1
BUF_VERSION := 1.32.2
COPYRIGHT_YEARS := 2023-2024

.PHONY: help
Expand Down Expand Up @@ -56,8 +56,8 @@ checkgenerate:

$(BIN)/buf: Makefile
@mkdir -p $(@D)
go install github.com/bufbuild/buf/cmd/buf@$(BUF_VERSION)
go install github.com/bufbuild/buf/cmd/buf@v$(BUF_VERSION)

$(BIN)/license-header: Makefile
@mkdir -p $(@D)
go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@$(BUF_VERSION)
go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v$(BUF_VERSION)

0 comments on commit 924b04d

Please sign in to comment.