Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do not merge] Prototype new GitHub workflows for push++ #105

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bufversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1.32.0-beta.1
23 changes: 23 additions & 0 deletions .github/workflows/buf-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: buf (Pull Request)
on:
- pull_request
jobs:
buf:
runs-on: ubuntu-latest
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'Skip Buf Breaking') }}
steps:
- name: Checkout PR head
uses: actions/checkout@v4
- name: Checkout PR base
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
path: .base
- name: Install buf cli
uses: bufbuild/buf-setup-action@v1
with:
version: 1.32.0-beta.1 # remove this flag when 1.32.0 is released so we go back to always tracking latest.
# todo: use .bufversion or the env variable?
github_token: ${{ github.token }} # is this necessary?
- name: buf breaking against PR base
run: buf breaking --against .base --error-format github-actions
24 changes: 24 additions & 0 deletions .github/workflows/buf-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: buf (Push)
on:
- push
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install buf cli
uses: bufbuild/buf-setup-action@v1
with:
version: 1.32.0-beta.1 # remove this flag when 1.32.0 is released so we go back to always tracking latest.
# todo: use .bufversion or the env variable?
Comment on lines +12 to +13
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line could be deleted if the action already supported .bufversion, which is in the proposal, but not implemented by the current action

github_token: ${{ github.token }} # is this necessary?
- name: buf build
run: buf build --error-format github-actions
- name: buf format
run: buf format --diff --exit-code --error-format github-actions
- name: buf lint
run: buf lint --error-format github-actions
- name: buf push
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as currently implemented, push doesn't happen on a branch if build, format, or lint fail

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to push even if lint and build fail?

run: buf push --label ${{ github.ref }} --git-metadata --error-format github-actions
with:
buf_token: ${{ secrets.BUF_TOKEN }}
45 changes: 0 additions & 45 deletions .github/workflows/buf.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: install
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x
- name: cache
uses: actions/cache@v4
with:
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ BIN := .tmp/bin
export PATH := $(BIN):$(PATH)
export GOBIN := $(abspath $(BIN))

BUF_VERSION := v1.29.0
BUF_VERSION_FILE := .bufversion
BUF_VERSION := $(shell cat ${BUF_VERSION_FILE})
COPYRIGHT_YEARS := 2023-2024

.PHONY: help
Expand All @@ -35,7 +36,7 @@ build: $(BIN)/buf ## Build all APIs
.PHONY: lint
lint: $(BIN)/buf ## Lint all APIs
buf lint
buf format -d --exit-code
buf format --diff --exit-code

.PHONY: upgrade
upgrade: $(BIN)/buf ## Upgrade dependencies
Expand Down
Loading