blob: bbe3bdd1a807cdc416ee1853f093a86f8ae20fb6 [file] [log] [blame]
name: Presubmits
on:
pull_request:
types: [opened, ready_for_review, synchronize]
jobs:
# Run clang-format and verify there are no errors. We don't want to bother
# building until we've at least got clean code.
# TODO(benvanik): add other checks (license, etc).
lint:
name: Code Style Check
runs-on: ubuntu-latest
steps:
- name: Installing dependencies
run: |
sudo add-apt-repository -y "deb http://mirror.enzu.com/ubuntu/ eoan main universe"
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends clang-format-9
wget https://raw.githubusercontent.com/llvm-mirror/clang/master/tools/clang-format/git-clang-format -O /tmp/git-clang-format
chmod +x /tmp/git-clang-format
- name: Checking out latest version and all submodules
run: |
git config --global remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*'
git clone https://github.com/$GITHUB_REPOSITORY $GITHUB_WORKSPACE --no-checkout --no-tags
git checkout $GITHUB_SHA
- name: Running clang-format on changed source files
# TODO(benvanik): actually filter to changed files.
run: |
/tmp/git-clang-format origin/master --binary=clang-format-9
git diff --exit-code