github action: Add buf-lint, fix buf (#10307)

* github action: Add buf-lint, fix buf

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto 2022-02-18 00:07:12 +01:00 committed by GitHub
parent aa8874bc56
commit e239e3ee8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 15 deletions

20
.github/workflows/buf-lint.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: buf.build
on:
pull_request:
paths:
- ".github/workflows/buf-lint.yml"
- "**.proto"
jobs:
buf:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bufbuild/buf-setup-action@v0.6.0
- uses: bufbuild/buf-lint-action@v1
with:
input: 'prompb'
- uses: bufbuild/buf-breaking-action@v1
with:
input: 'prompb'
against: 'https://github.com/prometheus/prometheus.git#branch=main,ref=HEAD,subdir=prompb'

View File

@ -1,20 +1,23 @@
name: buf.build
on:
push:
branches:
- main
jobs:
steps:
- uses: actions/checkout@v2
- uses: bufbuild/buf-setup-action@v0.6.0
- uses: bufbuild/buf-lint-action@v1
with:
input: 'prompb'
- uses: bufbuild/buf-breaking-action@v1
with:
input: 'prompb'
against: 'https://github.com/prometheus/prometheus.git#branch=main,ref=HEAD~1,subdir=prompb'
- uses: bufbuild/buf-push-action@v1
with:
input: 'prompb'
buf_token: ${{ secrets.BUF_TOKEN }}
buf:
name: lint and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bufbuild/buf-setup-action@v0.6.0
- uses: bufbuild/buf-lint-action@v1
with:
input: 'prompb'
- uses: bufbuild/buf-breaking-action@v1
with:
input: 'prompb'
against: 'https://github.com/prometheus/prometheus.git#branch=main,ref=HEAD~1,subdir=prompb'
- uses: bufbuild/buf-push-action@v1
with:
input: 'prompb'
buf_token: ${{ secrets.BUF_TOKEN }}

View File

@ -1,4 +1,18 @@
version: v1
name: buf.build/prometheus/prometheus
lint:
ignore_only:
ENUM_VALUE_PREFIX:
- remote.proto
- types.proto
ENUM_ZERO_VALUE_SUFFIX:
- remote.proto
- types.proto
PACKAGE_DIRECTORY_MATCH:
- remote.proto
- types.proto
PACKAGE_VERSION_SUFFIX:
- remote.proto
- types.proto
deps:
- buf.build/gogo/protobuf