Add automatic backend deploy and integration test to gitlab CI
parent
0d26854c35
commit
9382c7a9c0
|
@ -1,6 +1,7 @@
|
|||
stages:
|
||||
- build
|
||||
- test
|
||||
- backend-deploy-and-test
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -25,3 +26,25 @@ integration-test:
|
|||
tags:
|
||||
- blockbook
|
||||
script: make test-integration ARGS="-run='TestIntegration/(bcash|bgold|bitcoin|dash|dogecoin|litecoin|vertcoin|zcash)=main/'"
|
||||
|
||||
backend-deploy-and-test-bitcoin:
|
||||
stage: backend-deploy-and-test
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
changes:
|
||||
- configs/coins/bitcoin.json
|
||||
tags:
|
||||
- blockbook
|
||||
script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin bitcoin=main debug.log
|
||||
|
||||
backend-deploy-and-test-bitcoin_testnet:
|
||||
stage: backend-deploy-and-test
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
changes:
|
||||
- configs/coins/bitcoin_testnet.json
|
||||
tags:
|
||||
- blockbook
|
||||
script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin_testnet bitcoin=test testnet3/debug.log
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo "Usage: $(basename $(readlink -f $0)) coin [coin_test] [backend log file]" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COIN=$1
|
||||
COIN_TEST=$2
|
||||
LOGFILE=$3
|
||||
|
||||
[ -z "${BACKEND_TIMEOUT}" ] && BACKEND_TIMEOUT=15s
|
||||
[ -z "${COIN_TEST}" ] && COIN_TEST="${COIN}=main"
|
||||
[ -z "${LOGFILE}" ] && LOGFILE=debug.log
|
||||
|
||||
rm build/*.deb
|
||||
make "deb-backend-${COIN}"
|
||||
|
||||
PACKAGE=$(ls "./build/backend-${COIN}*.deb")
|
||||
[ -z "${PACKAGE}" ] && echo "Package not found" && exit 1
|
||||
|
||||
sudo /usr/bin/dpkg -i "${PACKAGE}" || exit 1
|
||||
sudo /bin/systemctl restart "backend-${COIN}" || exit 1
|
||||
timeout ${BACKEND_TIMEOUT} tail -f "/opt/coins/data/${COIN}/backend/${LOGFILE}"
|
||||
make test-integration ARGS="-v -run=TestIntegration/${COIN_TEST}"
|
||||
|
Loading…
Reference in New Issue