C++ #747
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 2020 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: C++ | |
on: | |
pull_request: | |
branches: | |
- main | |
- 'envoy-release/**' | |
- 'istio-release/**' | |
push: | |
branches: | |
- main | |
- 'envoy-release/**' | |
- 'istio-release/**' | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
format: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.16' | |
- name: Format (clang-format) | |
run: | | |
sudo apt-get install clang-format-12 | |
find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-12 -i | |
git diff --exit-code | |
- name: Format (buildifier) | |
run: | | |
go install github.com/bazelbuild/buildtools/buildifier@latest | |
export PATH=$PATH:$(go env GOPATH)/bin | |
find . -name "BUILD" | xargs -n1 buildifier -mode=check | |
- name: Format (addlicense) | |
run: | | |
go install github.com/google/addlicense@latest | |
export PATH=$PATH:$(go env GOPATH)/bin | |
addlicense -ignore="**/BUILD" -check . | |
protobuf: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install protobuf v3.9.1 | |
run: | | |
git clone https://github.com/protocolbuffers/protobuf | |
cd protobuf | |
git checkout v3.9.1 | |
./autogen.sh | |
./configure | |
make | |
sudo make install | |
sudo ldconfig | |
- name: Re-generate and verify protobuf artifacts | |
run: | | |
rm *.pb.{cc,h} | |
make protobuf | |
git diff --exit-code -G "(^[^ /])|(^\s+[^\*])" *.pb.{cc,h} | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Mount bazel cache | |
uses: actions/cache@v1 | |
with: | |
path: "/home/runner/.cache/bazel" | |
key: bazel | |
- name: Install bazelisk | |
run: | | |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64" | |
mkdir -p "${GITHUB_WORKSPACE}/bin/" | |
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel" | |
chmod +x "${GITHUB_WORKSPACE}/bin/bazel" | |
- name: Test | |
run: | | |
"${GITHUB_WORKSPACE}/bin/bazel" build //... |