Commit 5994e648 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] #689 Allow to make local builds

parent 1333c2d0
......@@ -7,6 +7,7 @@ export NVM_DIR="$HOME/.nvm"
# Prepare
ARCH="`uname -m | sed -e \"s/86_//\"`"
NVER="v6.11.2"
DUNITER_TAG=$1
# Folders
INITIAL_DIRECTORY=`pwd`
......@@ -28,10 +29,8 @@ mkdir -p "$DOWNLOADS"
cd "$DOWNLOADS"
if [ ! -d "$DOWNLOADS/duniter" ]; then
git clone https://github.com/duniter/duniter.git
mv "$INITIAL_DIRECTORY/duniter-source" duniter
cd duniter
COMMIT=`git rev-list --tags --max-count=1`
DUNITER_TAG=`echo $(git describe --tags $COMMIT) | sed 's/^v//'`
git checkout "v${DUNITER_TAG}"
cd ..
fi
......
......@@ -6,9 +6,9 @@ export NVM_DIR="$HOME/.nvm"
# Prepare
NVER=`node -v`
DUNITER_TAG=
ADDON_VERSION=48
NW_VERSION=0.17.6
DUNITER_TAG=$1
NW_RELEASE="v${NW_VERSION}"
NW="nwjs-${NW_RELEASE}-linux-x64"
NW_GZ="${NW}.tar.gz"
......@@ -35,10 +35,8 @@ rm -rf /vagrant/*.tar.gz
cd "$DOWNLOADS"
if [ ! -d "$DOWNLOADS/duniter" ]; then
git clone https://github.com/duniter/duniter.git
mv /vagrant/duniter-source duniter
cd duniter
COMMIT=`git rev-list --tags --max-count=1`
DUNITER_TAG=`echo $(git describe --tags $COMMIT) | sed 's/^v//'`
git checkout "v${DUNITER_TAG}"
cd ..
fi
......
......@@ -30,11 +30,11 @@ rd /s /q duniter
rd /s /q duniter_release
rd /s /q %NW%
echo "Clonage de Duniter..."
git clone https://github.com/duniter/duniter.git
mkdir duniter
xcopy C:\vagrant\duniter-source\* %cd%\duniter\* /s /e /Y
cd duniter
for /f "delims=" %%a in ('git rev-list --tags --max-count=1') do @set DUNITER_REV=%%a
for /f "delims=" %%a in ('git describe --tags %DUNITER_REV%') do @set DUNITER_TAG=%%a
for /f "delims=" %%x in (C:\vagrant\duniter_tag.txt) do set DUNITER_TAG=%%x
echo %DUNITER_TAG%
git checkout %DUNITER_TAG%
......
#!/bin/bash
TAG="$3"
ORIGIN="$4"
IS_LOCAL_TAG=0
if [[ -z "${TAG}" ]]; then
# Default tag = YEARMONTHDAY.HOURMINUTE.SECONDS
TAG="`date +\"%Y%m%d\"`.`date +\"%H%M\"`.`date +\"%S\"`"
IS_LOCAL_TAG=1
fi
if [[ -z "${ORIGIN}" ]]; then
# Default tag = local branch name
ORIGIN="$(cd ./; pwd)"
fi
case "$1" in
make)
case "$2" in
arm)
cd release/arch/arm
./build-arm.sh
#### PREPARE SOURCE CODE ####
rm -rf duniter-source
# Clone from remote
echo ">> VM: Cloning sources from ${ORIGIN}..."
git clone "${ORIGIN}" duniter-source
if [ ${IS_LOCAL_TAG} -eq 1 ]; then
cd duniter-source
echo ">> git tag v${TAG}..."
./release/new_version.sh "$TAG"
cd ..
fi
./build-arm.sh ${TAG}
if [ ! $? -eq 0 ]; then
echo ">> Something went wrong. Stopping build."
else
......@@ -17,10 +44,22 @@ make)
deb)
cd release/arch/debian
if [[ ! -f "duniter-desktop-$TAG-linux-x64.deb" ]]; then
#### PREPARE SOURCE CODE ####
rm -rf duniter-source
# Clone from remote
echo ">> VM: Cloning sources from ${ORIGIN}..."
git clone "${ORIGIN}" duniter-source
if [ ${IS_LOCAL_TAG} -eq 1 ]; then
cd duniter-source
./release/new_version.sh "$TAG"
cd ..
fi
[[ $? -eq 0 ]] && echo ">> Starting Vagrant Ubuntu VM..."
[[ $? -eq 0 ]] && vagrant up
[[ $? -eq 0 ]] && echo ">> VM: building Duniter..."
[[ $? -eq 0 ]] && vagrant ssh -- 'bash -s' < ./build-deb.sh
[[ $? -eq 0 ]] && vagrant ssh -- "bash -s ${TAG}" < ./build-deb.sh
if [ ! $? -eq 0 ]; then
echo ">> Something went wrong. Stopping build."
else
......@@ -35,11 +74,27 @@ make)
win)
cd release/arch/windows
if [[ ! -f "duniter-desktop-$TAG-windows-x64.exe" ]]; then
#### PREPARE SOURCE CODE ####
rm -rf duniter-source
# Clone from remote
echo ">> VM: Cloning sources from ${ORIGIN}..."
git clone "${ORIGIN}" duniter-source
echo "${TAG}" > duniter_tag.txt
if [ ${IS_LOCAL_TAG} -eq 1 ]; then
cd duniter-source
./release/new_version.sh "$TAG"
cd ..
fi
[[ $? -eq 0 ]] && echo ">> Starting Vagrant Windows VM..."
[[ $? -eq 0 ]] && vagrant up
rm -f duniter_tag.txt
if [ ! $? -eq 0 ]; then
echo ">> Something went wrong. Stopping build."
fi
rm -rf ./duniter-source
vagrant halt
echo ">> VM closed."
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment