Merge pull request #38 from chainguard-dev/create-pull-request/patch #350
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 Chainguard, Inc. | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Verify | |
on: | |
pull_request: | |
branches: [ 'main', 'release-*' ] | |
push: | |
branches: [ 'main', 'release-*' ] | |
jobs: | |
verify: | |
name: Verify Codegen | |
runs-on: ubuntu-latest | |
env: | |
GOPATH: ${{ github.workspace }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
path: ./src/github.com/${{ github.repository }} | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: './src/github.com/${{ github.repository }}/go.mod' | |
check-latest: true | |
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
#- name: Install protoc | |
# uses: arduino/setup-protoc@v1.1.2 | |
# arduino/setup-protoc@v1.1.2 can't install latest releases of protoc due | |
# to protoc changing their version naming scheme: | |
# https://github.com/arduino/setup-protoc/issues/33 | |
- name: Install Protoc | |
run: | | |
cd "$(mktemp -d)" | |
wget -O protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v26.1/protoc-26.1-linux-x86_64.zip | |
unzip protoc.zip -d . | |
chmod +x ./bin/protoc | |
echo "$(pwd)/bin" >> "$GITHUB_PATH" | |
- name: Install Dependencies | |
run: | | |
cd $(mktemp -d) | |
go install github.com/google/go-licenses@ceb292363ec84358c9a276ef23aa0de893e59b84 | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.33.0 | |
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0 | |
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.10.0 | |
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.10.0 | |
- name: Update Codegen | |
shell: bash | |
working-directory: ./src/github.com/${{ github.repository }} | |
run: | | |
./hack/update-codegen.sh | |
- name: Verify | |
uses: chainguard-dev/actions/nodiff@main | |
with: | |
path: ./src/github.com/${{ github.repository }} | |
fixup-command: "./hack/update-codegen.sh" |