Skip to content

Commit 4f7306a

Browse files
authored
ci: split format checks into separate file and jobs. (#264)
Signed-off-by: Piotr Sikora <[email protected]>
1 parent fc084b7 commit 4f7306a

File tree

3 files changed

+108
-74
lines changed

3 files changed

+108
-74
lines changed

.github/workflows/cargo.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/format.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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

.github/workflows/cpp.yml renamed to .github/workflows/test.yml

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: C++
15+
name: Test
1616

1717
on:
1818

@@ -33,33 +33,6 @@ on:
3333

3434
jobs:
3535

36-
format:
37-
runs-on: ubuntu-20.04
38-
39-
steps:
40-
- uses: actions/checkout@v2
41-
- uses: actions/setup-go@v2
42-
with:
43-
go-version: '^1.16'
44-
45-
- name: Format (clang-format)
46-
run: |
47-
sudo apt-get install clang-format-9
48-
find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-9 -i
49-
git diff --exit-code
50-
51-
- name: Format (buildifier)
52-
run: |
53-
go install github.com/bazelbuild/buildtools/buildifier@latest
54-
export PATH=$PATH:$(go env GOPATH)/bin
55-
find . -name "WORKSPACE" -o -name "*BUILD*" -o -name "*.bzl" | xargs -n1 buildifier -mode=check
56-
57-
- name: Format (addlicense)
58-
run: |
59-
go install github.com/google/addlicense@latest
60-
export PATH=$PATH:$(go env GOPATH)/bin
61-
addlicense -check .
62-
6336
test_data:
6437
name: build test data
6538

0 commit comments

Comments
 (0)