build: check compilation of each commit
Inspired by Rust Lightning's GH action :)
This commit is contained in:
parent
592a0c5699
commit
dce4d2abcd
20
.github/workflows/main.yml
vendored
20
.github/workflows/main.yml
vendored
@ -63,14 +63,16 @@ jobs:
|
|||||||
run: make rpc-check
|
run: make rpc-check
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# compile unit tests
|
# check commits
|
||||||
########################
|
########################
|
||||||
unit-compile:
|
check-commits:
|
||||||
name: compile unit tests
|
name: check commits
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: git checkout
|
- name: git checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: go cache
|
- name: go cache
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
@ -88,8 +90,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: '~${{ env.GO_VERSION }}'
|
go-version: '~${{ env.GO_VERSION }}'
|
||||||
|
|
||||||
- name: compile
|
- name: fetch and rebase on master
|
||||||
run: make unit pkg=... case=_NONE_
|
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
|
# lint code
|
||||||
|
5
scripts/check-commit.sh
Executable file
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
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
|
Loading…
Reference in New Issue
Block a user