| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ main ] |
| 6 |
pull_request: |
| 7 |
branches: [ main ] |
| 8 |
|
| 9 |
jobs: |
| 10 |
check: |
| 11 |
name: Project checks |
| 12 |
runs-on: ubuntu-20.04 |
| 13 |
timeout-minutes: 5 |
| 14 |
steps: |
| 15 |
- name: Check out code |
| 16 |
uses: actions/checkout@v2 |
| 17 |
with: |
| 18 |
path: src/github.com/containerd/protobuild |
| 19 |
fetch-depth: 25 |
| 20 |
|
| 21 |
- name: Project checks |
| 22 |
uses: containerd/project-checks@v1 |
| 23 |
with: |
| 24 |
working-directory: src/github.com/containerd/protobuild |
| 25 |
|
| 26 |
test: |
| 27 |
name: Test |
| 28 |
strategy: |
| 29 |
matrix: |
| 30 |
os: [ ubuntu-20.04, windows-2022 ] |
| 31 |
fail-fast: false |
| 32 |
runs-on: ${{ matrix.os }} |
| 33 |
timeout-minutes: 5 |
| 34 |
steps: |
| 35 |
- name: Check out code |
| 36 |
uses: actions/checkout@v2 |
| 37 |
with: |
| 38 |
path: src/github.com/containerd/protobuild |
| 39 |
fetch-depth: 25 |
| 40 |
|
| 41 |
- name: Setup environment |
| 42 |
shell: bash |
| 43 |
run: | |
| 44 |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV |
| 45 |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH |
| 46 |
|
| 47 |
- name: Check out code |
| 48 |
uses: actions/checkout@v2 |
| 49 |
with: |
| 50 |
path: src/github.com/containerd/protobuild |
| 51 |
|
| 52 |
- name: Test |
| 53 |
working-directory: src/github.com/containerd/protobuild |
| 54 |
run: | |
| 55 |
go test |
| 56 |
|
| 57 |
v1: |
| 58 |
name: Run with protoc-gen-go v1.3.5 |
| 59 |
runs-on: ubuntu-20.04 |
| 60 |
timeout-minutes: 5 |
| 61 |
steps: |
| 62 |
|
| 63 |
- name: Set up Go |
| 64 |
uses: actions/setup-go@v2 |
| 65 |
with: |
| 66 |
go-version: 1.16.x |
| 67 |
id: go |
| 68 |
|
| 69 |
- name: Setup environment |
| 70 |
shell: bash |
| 71 |
run: | |
| 72 |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV |
| 73 |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH |
| 74 |
|
| 75 |
- name: Check out code |
| 76 |
uses: actions/checkout@v2 |
| 77 |
with: |
| 78 |
path: src/github.com/containerd/protobuild |
| 79 |
|
| 80 |
- name: Build |
| 81 |
working-directory: src/github.com/containerd/protobuild |
| 82 |
run: | |
| 83 |
go build . |
| 84 |
|
| 85 |
- name: Install protoc |
| 86 |
run: | |
| 87 |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.5.0/protoc-3.5.0-linux-x86_64.zip |
| 88 |
sudo unzip -x protoc-3.5.0-linux-x86_64.zip -d /usr/local |
| 89 |
sudo chmod -R go+rX /usr/local/include |
| 90 |
sudo chmod go+x /usr/local/bin/protoc |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
- name: Install protoc-gen-go |
| 95 |
run: | |
| 96 |
go install github.com/golang/protobuf/[email protected] |
| 97 |
|
| 98 |
- name: Run protobuild to see all committed auto-generated files can be generated as is |
| 99 |
working-directory: src/github.com/containerd/protobuild |
| 100 |
run: | |
| 101 |
rm examples/foo/*.pb.* examples/bar/*.pb.* examples/nogrpc/*.pb.* |
| 102 |
export PATH=$(go env GOBIN):$PATH |
| 103 |
./protobuild github.com/containerd/protobuild/examples/bar github.com/containerd/protobuild/examples/foo github.com/containerd/protobuild/examples/nogrpc |
| 104 |
git diff --exit-code |
| 105 |
|
| 106 |
v2: |
| 107 |
name: Run with protoc-gen-go v1.26 |
| 108 |
runs-on: ubuntu-20.04 |
| 109 |
timeout-minutes: 5 |
| 110 |
steps: |
| 111 |
|
| 112 |
- name: Set up Go |
| 113 |
uses: actions/setup-go@v2 |
| 114 |
with: |
| 115 |
go-version: 1.16.x |
| 116 |
id: go |
| 117 |
|
| 118 |
- name: Setup environment |
| 119 |
shell: bash |
| 120 |
run: | |
| 121 |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV |
| 122 |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH |
| 123 |
|
| 124 |
- name: Check out code |
| 125 |
uses: actions/checkout@v2 |
| 126 |
with: |
| 127 |
path: src/github.com/containerd/protobuild |
| 128 |
|
| 129 |
- name: Build |
| 130 |
working-directory: src/github.com/containerd/protobuild |
| 131 |
run: | |
| 132 |
go build . |
| 133 |
|
| 134 |
- name: Install protoc |
| 135 |
run: | |
| 136 |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.18.1/protoc-3.18.1-linux-x86_64.zip |
| 137 |
sudo unzip -x protoc-3.18.1-linux-x86_64.zip -d /usr/local |
| 138 |
sudo chmod -R go+rX /usr/local/include |
| 139 |
sudo chmod go+x /usr/local/bin/protoc |
| 140 |
|
| 141 |
- name: Install protoc-gen-go and protoc-gen-go-grpc |
| 142 |
run: | |
| 143 |
go install google.golang.org/protobuf/cmd/[email protected] |
| 144 |
go install google.golang.org/grpc/cmd/[email protected] |
| 145 |
|
| 146 |
- name: Run protobuild to see all committed auto-generated files can be generated as is |
| 147 |
working-directory: src/github.com/containerd/protobuild |
| 148 |
run: | |
| 149 |
rm examples/v2/*.pb.* |
| 150 |
export PATH=$(go env GOBIN):$PATH |
| 151 |
./protobuild -f v2.toml github.com/containerd/protobuild/examples/v2 |
| 152 |
git diff --exit-code |