Skip to content

Add knobs to manipulate metric handling (#107) #347

Add knobs to manipulate metric handling (#107)

Add knobs to manipulate metric handling (#107) #347

Workflow file for this run

# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build and Test
on:
push:
branches:
- 'main'
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ["stable"]
command: ["build", "vet", "lint", "test", "testrace"]
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.version }}
cache: true
- name: Cache linter
uses: actions/cache@v3
with:
path: ~/go/bin/staticcheck
key: staticcheck-v0.4.3
if: ${{ matrix.command == 'lint' }}
- name: Install linter
run: go install honnef.co/go/tools/cmd/[email protected]
if: ${{ matrix.command == 'lint' }}
- name: Build the weaver binary
run: cd cmd/weaver-kube; go build .
if: ${{ matrix.command == 'test' || matrix.command == 'testrace' }}
- name: ${{ matrix.command }}
run: ./dev/build_and_test ${{ matrix.command }}
generate:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ["stable"]
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.version }}
cache: true
- name: Cache protoc-gen-go
uses: actions/cache@v3
with:
path: ~/go/bin/protoc-gen-go
key: protoc-gen-go-v1.26
- name: Cache addlicense
uses: actions/cache@v3
with:
path: ~/go/bin/addlicense
key: addlicense-v1.1.1
- name: Install protoc
run: sudo apt install -y protobuf-compiler
- name: Install protoc-gen-go
run: go install google.golang.org/protobuf/cmd/[email protected]
- name: Install addlicense
run: go install github.com/google/[email protected]
- name: Install weaver
run: go install github.com/ServiceWeaver/weaver/cmd/weaver
- name: Generate code
run: ./dev/build_and_test generate
- name: Check spurious changes
run: |
# TODO(mwhittaker): Check .pb.go files.
# Exclude .pb.go files, as the protoc version may differ.
if [[ $(git ls-files --modified --others | grep -v '.*\.pb\.go') ]]; then
for f in $(git ls-files --modified); do
if ! [[ $f == *.pb.go ]]; then
echo "❌ File $f modified."
git diff "$f"
fi
done
for f in $(git ls-files --others); do
echo "❌ File $f untracked."
done
echo "Run './dev/build_and_test generate' and commit the changes."
exit 1
fi
echo "Success ✅"