Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed May 24, 2024
0 parents commit b27ae94
Show file tree
Hide file tree
Showing 36 changed files with 42,117 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/*.js binary
23 changes: 23 additions & 0 deletions .github/workflows/add-to-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Add issues and PRs to project
on:
issues:
types:
- opened
- reopened
- transferred
pull_request_target:
types:
- opened
- reopened
issue_comment:
types:
- created
permissions:
issues: read
pull-requests: read
repository-projects: write
jobs:
call-workflow-add-to-project:
name: Call workflow to add issue to project
uses: bufbuild/base-workflows/.github/workflows/add-to-project.yaml@main
secrets: inherit
212 changes: 212 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
name: Buf action CI
on:
push:
pull_request:
branches:
- main
permissions:
contents: read
pull-requests: write
env:
BUF_VERSION: "1.32.1"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/setup-go@v5
with:
go-version: "^1.22"
cache: false
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-cache-${{ hashFiles('Makefile') }}
restory-keys: ${{ runner.os }}-go-cache-
- name: Build
run: |
make build
- name: Generate
run: |
make generate
- name: Check diff
run: |
make checkgenerate
setup:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: ./
with:
setup_only: true
- run: buf --version | grep $BUF_VERSION
setup-latest:
runs-on: ubuntu-latest
needs: build
env:
BUF_VERSION: "" # Use the latest version
steps:
- uses: actions/checkout@v4
- uses: ./
with:
setup_only: true
- run: buf --version
setup-macos:
needs: setup
if: github.event_name == 'push'
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
setup_only: true
- run: buf --version | grep $BUF_VERSION
setup-windows:
needs: setup
if: github.event_name == 'push'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
setup_only: true
- run: buf --version | Select-String -Pattern $env:BUF_VERSION -CaseSensitive -SimpleMatch
setup-self-hosted:
needs: setup
# Disable this job, only for testing.
if: false
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: ./
with:
setup_only: true
- run: buf --version | grep $BUF_VERSION
lint:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- run: |
mkdir -p proto/test/v1
printf 'version: v2\nmodules:\n - path: proto' > buf.yaml
printf 'syntax = "proto3"; package test.v1; message A { string a = 1; }' > proto/test/v1/test.proto
- uses: ./
with:
lint: true
format: false
breaking: false
push: false
archive: false
comment: false
format:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- run: |
mkdir -p proto
printf 'version: v2\nmodules:\n - path: proto' > buf.yaml
printf 'syntax = "proto3";\n\nmessage A {\n string a = 1;\n}\n' > proto/test.proto
- uses: ./
with:
lint: false
format: true
breaking: false
push: false
archive: false
comment: false
breaking:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- run: |
mkdir -p proto
printf 'version: v2\nmodules:\n - path: proto' > buf.yaml
printf 'syntax = "proto3"; message A { string a = 1; }' > proto/test.proto
- uses: ./
with:
lint: false
format: false
breaking: true
breaking_against: .
push: false
archive: false
comment: false
comment:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: [lint,format,breaking]
steps:
- uses: actions/checkout@v4
- env:
BUF_USERNAME: ${{ secrets.BUF_USERNAME }}
run: |
# Lint skipped, format fails, breaking succeeds
mkdir -p proto
printf 'version: v2\nmodules:\n - path: proto' > buf.yaml
printf 'syntax = "proto3"; message A { string a = 1; }' > proto/test.proto
- uses: ./
continue-on-error: true # format fails
with:
username: ${{ secrets.BUF_USERNAME }}
token: ${{ secrets.BUF_TOKEN }}
lint: false # lint skipped
format: true
breaking: true
breaking_against: .
push: false
archive: false
comment: true
push:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }} # --git-metadata is only available on push
needs: build
steps:
- uses: actions/checkout@v4
- env:
BUF_USERNAME: ${{ secrets.BUF_USERNAME }}
run: |
mkdir -p proto/foo/v1
printf "version: v2\nmodules:\n - path: proto\n name: buf.build/${BUF_USERNAME}/foo\n" > buf.yaml
printf "syntax = \"proto3\";\npackage foo.v1;\nmessage Bar {}\n" > proto/foo/v1/bar.proto
- uses: ./
with:
username: ${{ secrets.BUF_USERNAME }}
token: ${{ secrets.BUF_TOKEN }}
lint: false
format: false
breaking: false
push: true
archive: false
comment: false
archive:
if: github.event_name == 'push' && github.ref_name != github.event.repository.default_branch
runs-on: ubuntu-latest
needs: push
steps:
- uses: actions/checkout@v4
- env:
BUF_USERNAME: ${{ secrets.BUF_USERNAME }}
run: |
mkdir -p proto/foo/v1
printf "version: v2\nmodules:\n - path: proto\n name: buf.build/${BUF_USERNAME}/foo\n" > buf.yaml
printf "syntax = \"proto3\";\npackage foo.v1;\nmessage Bar {}\n" > proto/foo/v1/bar.proto
- uses: ./
with:
username: ${{ secrets.BUF_USERNAME }}
token: ${{ secrets.BUF_TOKEN }}
lint: false
format: false
breaking: false
push: false
archive: true
comment: false
12 changes: 12 additions & 0 deletions .github/workflows/emergency-review-bypass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Bypass review in case of emergency
on:
pull_request:
types:
- labeled
permissions:
pull-requests: write
jobs:
approve:
if: github.event.label.name == 'Emergency Bypass Review'
uses: bufbuild/base-workflows/.github/workflows/emergency-review-bypass.yaml@main
secrets: inherit
13 changes: 13 additions & 0 deletions .github/workflows/notify-approval-bypass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: PR Approval Bypass Notifier
on:
pull_request:
types:
- closed
branches:
- main
permissions:
pull-requests: read
jobs:
approval:
uses: bufbuild/base-workflows/.github/workflows/notify-approval-bypass.yaml@main
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint PR Title
# Prevent writing to the repository using the CI token.
# Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
permissions:
pull-requests: read
on:
pull_request:
# By default, a workflow only runs when a pull_request's activity type is opened,
# synchronize, or reopened. We explicity override here so that PR titles are
# re-linted when the PR text content is edited.
types:
- opened
- edited
- reopened
- synchronize
jobs:
lint:
uses: bufbuild/base-workflows/.github/workflows/pr-title.yaml@main
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.idea/
/.tmp/
/.vscode/
/node_modules/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore artifacts
dist
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit b27ae94

Please sign in to comment.