-
Notifications
You must be signed in to change notification settings - Fork 69
171 lines (133 loc) · 4.98 KB
/
format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# 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 * * *'
concurrency:
group: ${{ github.head_ref || github.run_id }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
addlicense:
name: verify licenses
runs-on: ubuntu-20.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-20.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-20.04
steps:
- uses: actions/checkout@v2
- name: Install dependencies (Linux)
run: sudo apt update -y && sudo apt install -y clang-format-12
- name: Format (clang-format)
run: |
find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-12 -i
git diff --exit-code
clang_tidy:
name: check format with clang-tidy
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install dependencies (Linux)
run: sudo apt update -y && sudo apt install -y clang-tidy-12 lld-12 && sudo ln -sf /usr/bin/lld-12 /usr/bin/lld
- name: Bazel cache
uses: PiotrSikora/[email protected]
with:
path: |
~/.cache/bazel
key: clang_tidy-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl', 'bazel/cargo/wasmsign/remote/crates.bzl') }}
- name: Bazel build
run: >
bazel build
--config clang-tidy
--define engine=multi
--copt=-DPROXY_WASM_VERIFY_WITH_ED25519_PUBKEY=\"$(xxd -p -c 256 test/test_data/signature_key1.pub | cut -b9-)\"
//...
- name: Skip Bazel cache update
if: ${{ github.ref != 'refs/heads/main' }}
run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV
- name: Cleanup Bazel cache
if: ${{ github.ref == 'refs/heads/main' }}
run: |
export OUTPUT=$(${{ matrix.run_under }} bazel info output_base)
echo "===== BEFORE ====="
du -s ${OUTPUT}/external/* $(dirname ${OUTPUT})/* | sort -rn | head -20
# BoringSSL's test data (90 MiB).
rm -rf ${OUTPUT}/external/boringssl/crypto_test_data.cc
rm -rf ${OUTPUT}/external/boringssl/src/crypto/*/test/
rm -rf ${OUTPUT}/external/boringssl/src/third_party/wycheproof_testvectors/
# LLVM's tests (500 MiB).
rm -rf ${OUTPUT}/external/llvm*/test/
# V8's tests (100 MiB).
if [ -d "${OUTPUT}/external/v8/test/torque" ]; then
mv ${OUTPUT}/external/v8/test/torque ${OUTPUT}/external/v8/test_torque
rm -rf ${OUTPUT}/external/v8/test/*
mv ${OUTPUT}/external/v8/test_torque ${OUTPUT}/external/v8/test/torque
fi
# Unnecessary CMake tools (65 MiB).
rm -rf ${OUTPUT}/external/cmake-*/bin/{ccmake,cmake-gui,cpack,ctest}
# Distfiles for Rust toolchains (350 MiB).
rm -rf ${OUTPUT}/external/rust_*/*.tar.gz
# Bazel's repository cache (650-800 MiB) and install base (155 MiB).
rm -rf ${OUTPUT}/../cache
rm -rf ${OUTPUT}/../install
echo "===== AFTER ====="
du -s ${OUTPUT}/external/* $(dirname ${OUTPUT})/* | sort -rn | head -20