Merge pull request #4843 from cfromknecht/check-each-commit

build: check compilation of each commit
This commit is contained in:
Conner Fromknecht 2020-12-09 13:52:49 -08:00 committed by GitHub
commit 745ea9b70e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 5 deletions

@ -63,14 +63,16 @@ jobs:
run: make rpc-check
########################
# compile unit tests
# check commits
########################
unit-compile:
name: compile unit tests
check-commits:
name: check commits
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: go cache
uses: actions/cache@v1
@ -88,8 +90,16 @@ jobs:
with:
go-version: '~${{ env.GO_VERSION }}'
- name: compile
run: make unit pkg=... case=_NONE_
- name: fetch and rebase on master
run: |
git remote add upstream https://github.com/lightningnetwork/lnd
git fetch upstream
export GIT_COMMITTER_EMAIL="lnd-ci@example.com"
export GIT_COMMITTER_NAME="LND CI"
git rebase upstream/master
- name: check commits
run: scripts/check-each-commit.sh upstream/master
########################
# lint code

5
scripts/check-commit.sh Executable file

@ -0,0 +1,5 @@
#!/bin/bash
set -e
set -x
echo Testing $(git log -1 --oneline)
make unit pkg=... case=_NONE_

15
scripts/check-each-commit.sh Executable file

@ -0,0 +1,15 @@
#!/bin/bash
if [[ "$1" = "" ]]; then
echo "USAGE: $0 remote/head_branch"
echo "eg $0 upstream/master"
exit 1
fi
set -e
set -x
if [[ "$(git log --pretty="%H %D" | grep "^[0-9a-f]*.* $1")" = "" ]]; then
echo "It seems like the current checked-out commit is not based on $1"
exit 1
fi
git rebase --exec scripts/check-commit.sh $1