ci(actions): bump & add go versions to matrix #235
Workflow file for this run
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
name: Tests | |
on: | |
push: | |
paths-ignore: | |
- "*.md" | |
pull_request: | |
paths-ignore: | |
- "*.md" | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
golang: ["1.20", "1.21", "1.22"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "${{ matrix.golang }}" | |
cache: true | |
- run: go version | |
- name: install protobuf compiler | |
run: | | |
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-x86_64.zip | |
unzip protoc-21.7-linux-x86_64.zip | |
sudo cp bin/protoc /usr/bin/ | |
sudo cp -Rf include/* /usr/include | |
wget https://github.com/protocolbuffers/protobuf-go/releases/download/v1.28.1/protoc-gen-go.v1.28.1.linux.amd64.tar.gz | |
tar -xf protoc-gen-go.v1.28.1.linux.amd64.tar.gz | |
sudo cp protoc-gen-go /usr/bin/ | |
- name: check if proto file is synced with kong | |
run: | | |
rm ./server/kong_plugin_protocol/pluginsocket.proto | |
make ./server/kong_plugin_protocol/pluginsocket.proto | |
# see if we got the same proto file | |
git diff --exit-code --name-only -- '*.proto' | |
if [ $? -ne 0 ]; then | |
echo "proto file is out of sync with kong master" | |
exit 1 | |
fi | |
- name: check if pb.go is modified manually | |
run: | | |
rm ./server/kong_plugin_protocol/pluginsocket.pb.go | |
make ./server/kong_plugin_protocol/pluginsocket.pb.go | |
# see if we can reproduce the same pb.go file | |
git diff --exit-code --name-only -- '*.pb.go' | |
if [ $? -ne 0 ]; then | |
echo "pb.go is modified manually" | |
exit 1 | |
fi | |
- name: Dependency | |
run: make dep | |
- name: Lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
args: --exclude composites | |
- name: Test | |
run: make test | |
- name: Build example plugins | |
run: | | |
cd examples | |
rm go.sum | |
go mod tidy | |
go build go-hello.go | |
test -f go-hello | |
go build go-log.go | |
test -f go-log |