Skip to content

Commit

Permalink
Use GH Actions instead of Travis (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
awegrzyn authored Dec 14, 2020
1 parent 4300191 commit 124b9cd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 56 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Clang format

on: [pull_request]

jobs:
clang-format-8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run clang-foramt on changed files
run: |
set -x
git fetch origin ${{ github.event.pull_request.base.ref }}
git fetch origin pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
BASE_COMMIT=$(git rev-parse ${{ github.event.pull_request.base.sha }})
COMMIT_FILES=$(git diff --name-only ${BASE_COMMIT} | grep -i -v LinkDef)
RESULT_OUTPUT=$(git-clang-format-8 --commit ${BASE_COMMIT} --diff --binary $(which clang-format-8) ${COMMIT_FILES})
if [ "$RESULT_OUTPUT" == "no modified files to format" ] || [ "$RESULT_OUTPUT" == "clang-format did not modify any files" ]; then
exit 0
else
git-clang-format-8 --commit $BASE_COMMIT --diff --binary $(which clang-format-8)
echo "$RESULT_OUTPUT"
exit 1
fi
56 changes: 0 additions & 56 deletions .travis.yml

This file was deleted.

0 comments on commit 124b9cd

Please sign in to comment.