Skip to content
1 change: 0 additions & 1 deletion .ci/format_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -ex

BASE_COMMIT=$(git rev-parse $TRAVIS_BRANCH)
Comment thread
Axel-Naumann marked this conversation as resolved.
echo "Running clang-format against branch $TRAVIS_BRANCH, with hash $BASE_COMMIT"
COMMIT_FILES=$(git diff --name-only $BASE_COMMIT | grep -i -v LinkDef)
RESULT_OUTPUT="$(git-clang-format --commit $BASE_COMMIT --diff --binary `which clang-format` $COMMIT_FILES)"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/code_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: clang-tools code analysis

on: pull_request
# push:
# branches: [ $default-branch ]
# pull_request:
# branches: [ $default-branch ]

jobs:
clang-format:
runs-on: ubuntu-latest
env:
TRAVIS_BRANCH: ${{ github.base_ref }}
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
steps:
- uses: actions/checkout@v2
- name: Fetch base_ref HEAD
run: git fetch --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}}
- name: install clang-format
run: sudo apt-get install -y clang-format
- name: run clang-format script
run: .ci/format_script.sh
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ matrix:
include:
- env: TOOL=clang-format
script: &format_script
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then .ci/format_script.sh; fi
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
export BASE_COMMIT=$(git rev-parse $TRAVIS_BRANCH)
.ci/format_script.sh
fi
Comment thread
Axel-Naumann marked this conversation as resolved.

- env: TOOL=clang-tidy-analyzer
before_script: &copy_headers
Expand Down