Format #1913
This file contains hidden or 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: Format | |
on: | |
pull_request: | |
branches: | |
- main | |
- 'envoy-release/**' | |
- 'istio-release/**' | |
push: | |
branches: | |
- main | |
- 'envoy-release/**' | |
- 'istio-release/**' | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
addlicense: | |
name: verify licenses | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.16' | |
- name: Install dependencies | |
run: | | |
go install github.com/google/addlicense@latest | |
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | |
- name: Format (addlicense) | |
run: addlicense -ignore "bazel/cargo/*/remote/**" -check . | |
buildifier: | |
name: check format with buildifier | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.16' | |
- name: Install dependencies | |
run: | | |
go install github.com/bazelbuild/buildtools/buildifier@latest | |
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | |
- name: Format (buildifier) | |
run: find . -name "WORKSPACE" -o -name "*BUILD*" -o -name "*.bzl" | xargs -n1 buildifier -mode=check | |
rules_rust: | |
name: check format with rules_rust | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Format (bazel query) | |
run: | | |
bazel query 'deps(//bazel/cargo/...)' | |
- name: Format (rules_rust) | |
run: | | |
bazel run //bazel/cargo/wasmsign:crates_vendor | |
bazel run //bazel/cargo/wasmtime:crates_vendor | |
git diff --exit-code | |
clang_format: | |
name: check format with clang-format | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install dependencies (Linux) | |
run: sudo apt update -y && sudo apt install -y clang-format-18 | |
- name: Format (clang-format) | |
run: | | |
find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-18 -i | |
git diff --exit-code | |
clang_tidy: | |
name: check format with clang-tidy | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install dependencies (Linux) | |
run: sudo apt update -y && sudo apt install -y clang-tidy-18 lld-18 && sudo ln -sf /usr/bin/lld-18 /usr/bin/lld | |
- name: set cache name | |
id: vars | |
# The cache tag consists of the following parts: | |
# * clang-tidy- prefix | |
# * matrix.name, which separates the cache for each build type. | |
# * hash of WORKSPACE, .bazelrc, and .bazelversion, which is | |
# purely to differentiate caches for substantial changes in bazel. | |
# * github.sha, which is the commit hash of the commit used to generate | |
# the cache entry. | |
run: echo "CACHE_TAG=clang-tidy-${{ matrix.name }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion') }}" >> "$GITHUB_OUTPUT" | |
- name: bazel cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: /tmp/bazel/cache | |
key: ${{ steps.vars.outputs.CACHE_TAG }}-${{ github.sha }} | |
restore-keys: | | |
${{ steps.vars.outputs.CACHE_TAG }}-${{ github.sha }} | |
${{ steps.vars.outputs.CACHE_TAG }}- | |
clang-tidy-${{ matrix.name }}- | |
clang-tidy- | |
- name: Bazel build | |
run: > | |
bazel build | |
--config clang-tidy | |
--define engine=multi | |
--disk_cache /tmp/bazel/cache | |
--copt=-DPROXY_WASM_VERIFY_WITH_ED25519_PUBKEY=\"$(xxd -p -c 256 test/test_data/signature_key1.pub | cut -b9-)\" | |
//... | |
- name: save bazel cache | |
uses: actions/cache/save@v3 | |
if: always() | |
with: | |
path: /tmp/bazel/cache | |
key: ${{ steps.vars.outputs.CACHE_TAG }}-${{ github.sha }} |