Skip to content

ci: split format checks into separate file and jobs. #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/workflows/cargo.yml

This file was deleted.

107 changes: 107 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# 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:
- master
- 'envoy-release/**'
- 'istio-release/**'

push:
branches:
- master
- 'envoy-release/**'
- 'istio-release/**'

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 -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

cargo_raze:
name: check format with cargo-raze

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: cargo install cargo-raze --version 0.14.1

- name: Format (cargo raze)
working-directory: bazel/cargo
run: |
cd wasmsign && cargo raze && cd ..
cd wasmtime && cargo raze && cd ..
# Ignore manual changes in "errno" crate until fixed in cargo-raze.
# See: https://github.com/google/cargo-raze/issues/451
git diff --exit-code -- ':!wasmtime/remote/BUILD.errno-0.2.8.bazel'

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-get 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
29 changes: 1 addition & 28 deletions .github/workflows/cpp.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: C++
name: Test

on:

Expand All @@ -33,33 +33,6 @@ on:

jobs:

format:
runs-on: ubuntu-20.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-9
find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-9 -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 "WORKSPACE" -o -name "*BUILD*" -o -name "*.bzl" | xargs -n1 buildifier -mode=check

- name: Format (addlicense)
run: |
go install github.com/google/addlicense@latest
export PATH=$PATH:$(go env GOPATH)/bin
addlicense -check .

test_data:
name: build test data

Expand Down