Skip to content

Commit

Permalink
Use buf-action in CI
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 lint, format and breaking change detection
  checks.
- On push to main: push the changes of the latest commit with the label
  of the current branch (main).

The following changes were made to support the new aciton:
- The file `.bufversion` at the repository root now controls the version.
  This is read by both the Makefile and the action to fetch the correct
  version of buf.
- Checks no longer block pushes of commits to the BSR.
- Formatting checks have been added to `buf-ci.yaml`.
  • Loading branch information
emcfarlane committed Jun 3, 2024
1 parent 8e23155 commit 4f8001b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 50 deletions.
1 change: 1 addition & 0 deletions .bufversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.32.2
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
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
permissions:
contents: read
pull-requests: write
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/[email protected]
with:
token: ${{ secrets.BUF_TOKEN }}
45 changes: 0 additions & 45 deletions .github/workflows/buf.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ jobs:
- name: install
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x
cache: false
- name: cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-registry-proto-ci-${{ hashFiles('**/Makefile') }}
key: ${{ runner.os }}-registry-proto-ci-${{ hashFiles('.bufversion') }}
restore-keys: ${{ runner.os }}-registry-proto-ci-
- name: make
run: make
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 ?= $(shell cat .bufversion)
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 4f8001b

Please sign in to comment.