Browse Source

build: check compilation of each commit

Inspired by Rust Lightning's GH action :)
master
Conner Fromknecht 3 years ago
parent
commit
dce4d2abcd
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
  1. 20
      .github/workflows/main.yml
  2. 5
      scripts/check-commit.sh
  3. 15
      scripts/check-each-commit.sh

20
.github/workflows/main.yml

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

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

@ -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
Loading…
Cancel
Save