-
Notifications
You must be signed in to change notification settings - Fork 15
86 lines (76 loc) · 2.45 KB
/
ci_proto.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
workflow_call:
# Run as part of the merge train.
merge_group:
branches: ["main"]
# In cases of concurrent workflows running (consecutive pushes to PR)
# leave the latest workflow and cancel the other (older) workflows
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: write
# Used by linter to write lint problems.
checks: write
contents: read
name: Protobuf CI
jobs:
proto_skip:
name: Proto Skip Unchanged
continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
run_id: ${{ fromJSON(steps.skip_check.outputs.skipped_by).id }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: "never"
skip_after_successful_duplicate: "true"
paths: '["proto/**/*.proto", "proto/buf.*"]'
do_not_skip: '["workflow_dispatch", "schedule"]'
proto_build:
name: Generate Protobufs
runs-on: ubuntu-latest
if: needs.proto_skip.outputs.should_skip != 'true'
steps:
- uses: actions/checkout@v3
- name: Install Buf
uses: bufbuild/[email protected]
with:
version: "1.17.0"
buf_user: ${{ secrets.BUF_USER }}
buf_api_token: ${{ secrets.BUF_API_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Protos
run: buf generate
working-directory: proto
proto_lint:
name: Lint Protobufs
runs-on: ubuntu-latest
if: needs.proto_skip.outputs.should_skip != 'true'
steps:
- uses: actions/checkout@v3
- name: Install Buf
uses: bufbuild/[email protected]
with:
version: "1.17.0"
buf_user: ${{ secrets.BUF_USER }}
buf_api_token: ${{ secrets.BUF_API_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint Protos
uses: bufbuild/buf-lint-action@v1
with:
input: proto
- name: Format Protos
run: buf format -d --exit-code
working-directory: proto
# TODO: Use buf actions for better PR experiences
# https://github.com/marketplace/actions/buf-breaking