|
| 1 | +# Copyright 2020 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Format |
| 16 | + |
| 17 | +on: |
| 18 | + |
| 19 | + pull_request: |
| 20 | + branches: |
| 21 | + - master |
| 22 | + - 'envoy-release/**' |
| 23 | + - 'istio-release/**' |
| 24 | + |
| 25 | + push: |
| 26 | + branches: |
| 27 | + - master |
| 28 | + - 'envoy-release/**' |
| 29 | + - 'istio-release/**' |
| 30 | + |
| 31 | +jobs: |
| 32 | + |
| 33 | + addlicense: |
| 34 | + name: verify licenses |
| 35 | + |
| 36 | + runs-on: ubuntu-20.04 |
| 37 | + |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + |
| 41 | + - uses: actions/setup-go@v2 |
| 42 | + with: |
| 43 | + go-version: '^1.16' |
| 44 | + |
| 45 | + - name: Install dependencies |
| 46 | + run: | |
| 47 | + go install github.com/google/addlicense@latest |
| 48 | + echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" |
| 49 | +
|
| 50 | + - name: Format (addlicense) |
| 51 | + run: addlicense -check . |
| 52 | + |
| 53 | + buildifier: |
| 54 | + name: check format with buildifier |
| 55 | + |
| 56 | + runs-on: ubuntu-20.04 |
| 57 | + |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v2 |
| 60 | + |
| 61 | + - uses: actions/setup-go@v2 |
| 62 | + with: |
| 63 | + go-version: '^1.16' |
| 64 | + |
| 65 | + - name: Install dependencies |
| 66 | + run: | |
| 67 | + go install github.com/bazelbuild/buildtools/buildifier@latest |
| 68 | + echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" |
| 69 | +
|
| 70 | + - name: Format (buildifier) |
| 71 | + run: find . -name "WORKSPACE" -o -name "*BUILD*" -o -name "*.bzl" | xargs -n1 buildifier -mode=check |
| 72 | + |
| 73 | + cargo_raze: |
| 74 | + name: check format with cargo-raze |
| 75 | + |
| 76 | + runs-on: ubuntu-latest |
| 77 | + |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v2 |
| 80 | + |
| 81 | + - name: Install dependencies |
| 82 | + run: cargo install cargo-raze --version 0.14.1 |
| 83 | + |
| 84 | + - name: Format (cargo raze) |
| 85 | + working-directory: bazel/cargo |
| 86 | + run: | |
| 87 | + cd wasmsign && cargo raze && cd .. |
| 88 | + cd wasmtime && cargo raze && cd .. |
| 89 | + # Ignore manual changes in "errno" crate until fixed in cargo-raze. |
| 90 | + # See: https://github.com/google/cargo-raze/issues/451 |
| 91 | + git diff --exit-code -- ':!wasmtime/remote/BUILD.errno-0.2.8.bazel' |
| 92 | +
|
| 93 | + clang_format: |
| 94 | + name: check format with clang-format |
| 95 | + |
| 96 | + runs-on: ubuntu-20.04 |
| 97 | + |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v2 |
| 100 | + |
| 101 | + - name: Install dependencies (Linux) |
| 102 | + run: sudo apt-get install -y clang-format-12 |
| 103 | + |
| 104 | + - name: Format (clang-format) |
| 105 | + run: | |
| 106 | + find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-12 -i |
| 107 | + git diff --exit-code |
0 commit comments