check if commit is on master

This commit is contained in:
abejgonzalez
2019-06-02 23:25:51 -07:00
parent c037a6fe8b
commit eb93ace725
2 changed files with 59 additions and 0 deletions

40
.circleci/check-commit.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
# check to see that submodule commits are present on the master branch
# turn echo on and error on earliest command
set -ex
# enter bhd repo
cd $HOME/project
# initialize submodules and get the hashes
git submodule update --init
status=$(git submodule status)
search () {
for submodule in "${submodules[@]}"
do
echo "Running check on submodule $submodule in $dir"
hash=$(echo "$status" | grep $submodule | awk '{print$1}' | grep -o "[[:alnum:]]*")
echo "Searching for $hash in origin/master of $submodule"
git -C $dir/$submodule log origin/master | grep "$hash" # needs init'ed submodules
done
}
submodules=("boom" "hwacha" "rocket-chip" "sifive-blocks" "testchipip")
dir="generators"
search
submodules=("esp-tools" "riscv-tools")
dir="toolchains"
search
submodules=("barstools" "chisel3" "firrtl" "torture")
dir="tools"
search
echo "Done checking all submodules"

View File

@@ -5,6 +5,22 @@ version: 2
# set of jobs to run
jobs:
commit-on-master-check:
docker:
- image: riscvboom/riscvboom-images:0.0.5
environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb
steps:
# Checkout the code
- checkout
- run:
name: Check commits of each submodule
command: |
.circleci/check-commit.sh
install-riscv-toolchain:
docker:
- image: riscvboom/riscvboom-images:0.0.5
@@ -470,6 +486,9 @@ workflows:
version: 2
build-and-test-rebar-integration:
jobs:
# check to make sure commits are on master
- commit-on-master-check
# Make the toolchains
- install-riscv-toolchain