build: move scripts to scripts dir

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-01-07 22:34:41 +02:00
parent b32d307452
commit ba8ca7319d
8 changed files with 27 additions and 10 deletions
+80
View File
@@ -0,0 +1,80 @@
#!/bin/bash
set -e
BUILD_DIR=build
INSTALL_DIR=usr
BIN_DIR=$BUILD_DIR/$INSTALL_DIR/bin
print_error()
{
echo -e "\e[31m$1\e[0m"
}
if [ ! -d "dvc" ]; then
print_error "Please run this script from repository root"
exit 1
fi
trap 'print_error "FAIL"; exit 1' ERR
print_info()
{
echo -e "\e[32m$1\e[0m"
}
command_exists()
{
command -v $1 > /dev/null 2>&1
}
fpm_build()
{
print_info "Building $1..."
VERSION=$(python -c "import dvc; from dvc import VERSION; print(str(VERSION))")
fpm -s dir -f -t $1 -n dvc -v $VERSION -C $BUILD_DIR $INSTALL_DIR
}
cleanup()
{
print_info "Cleaning up..."
rm -rf build
}
install_dependencies()
{
print_info "Installing fpm..."
if command_exists dnf; then
sudo dnf install ruby-devel gcc make rpm-build
elif command_exists yum; then
sudo yum install ruby-devel gcc make rpm-build
elif command_exists apt-get; then
sudo apt-get update -y
sudo apt-get install ruby-dev build-essential rpm python-pip python-dev
else
echo "Unable to install fpm dependencies" && exit 1
fi
gem install --no-ri --no-rdoc fpm
print_info "Installing requirements..."
pip install -r requirements.txt
print_info "Installing pyinstaller..."
pip install pyinstaller
}
build_dvc()
{
print_info "Building dvc binary..."
pyinstaller --onefile --additional-hooks-dir $(pwd)/hooks dvc/__main__.py --name dvc --distpath $BIN_DIR --specpath $BUILD_DIR
}
cleanup
install_dependencies
build_dvc
fpm_build rpm
fpm_build deb
cleanup
print_info "Successfully built dvc rpm and deb packages"
+68
View File
@@ -0,0 +1,68 @@
#!/bin/sh
set -e
BUILD_DIR=build
INSTALL_DIR=usr/local
BIN_DIR=$BUILD_DIR/$INSTALL_DIR/bin
print_error()
{
echo -e "\e[31m$1\e[0m"
}
if [ ! -d "dvc" ]; then
print_error "Please run this script from repository root"
exit 1
fi
trap 'print_error "FAIL"; exit 1' ERR
print_info()
{
echo -e "\e[32m$1\e[0m"
}
command_exists()
{
command -v $1 > /dev/null 2>&1
}
fpm_build()
{
print_info "Building $1..."
VERSION=$(python -c "import dvc; from dvc import VERSION; print(str(VERSION))")
fpm -s dir -f -t $1 --osxpkg-identifier-prefix com.dataversioncontrol -n dvc -v $VERSION -C $BUILD_DIR $INSTALL_DIR
}
cleanup()
{
print_info "Cleaning up..."
rm -rf build
}
install_dependencies()
{
print_info "Installing requirements..."
pip install -r requirements.txt
print_info "Installing fpm..."
gem install --no-ri --no-rdoc fpm
print_info "Installing pyinstaller..."
pip install pyinstaller
}
build_dvc()
{
print_info "Building dvc binary..."
pyinstaller --onefile --additional-hooks-dir $(pwd)/hooks dvc/__main__.py --name dvc --distpath $BIN_DIR --specpath $BUILD_DIR
}
cleanup
install_dependencies
build_dvc
fpm_build osxpkg
cleanup
print_info "Successfully built dvc osx package"
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
set -e
if [ ! -d "dvc" ]; then
echo "Please run this script from repository root"
exit 1
fi
python setup.py sdist
python setup.py bdist_wheel --universal
+37
View File
@@ -0,0 +1,37 @@
@echo Off
echo ====== Starting to build dvc installer for Windows... ======
if not exist dvc\NUL (echo Error: Please run this script from repository root && goto :error)
rmdir /Q /S build
rmdir /Q /S dist
del /Q /S dvc.spec
del /Q /S "dvc-*.exe"
where pip
if %errorlevel% neq 0 (echo Error: pip not found && goto :error)
if not exist "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" (echo Error: Couldn't find Inno Setup compiler. Please go to jrsoftware.org/isinfo.php and install Inno Setup 5 && goto :error)
echo ====== Installing requirements... ======
call pip install -r requirements.txt || goto :error
call pip install pyinstaller || goto :error
echo ====== Building dvc binary... ======
call pyinstaller --onefile --additional-hooks-dir hooks dvc/__main__.py --name dvc --specpath build
echo ====== Copying additional files... ======
copy innosetup\addSymLinkPermissions.ps1 dist\ || goto :error
echo ====== Building dvc installer... ======
set PYTHONPATH=%cd%
call python innosetup\config_gen.py || goto :error
call "C:\Program Files (x86)\Inno Setup 5\iscc" innosetup\setup.iss || goto :error
echo ====== DONE ======
goto :EOF
:error
echo ====== FAIL ======
exit /b 1
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
if [[ "$TRAVIS_OS_NAME" == "linux" && \
"$(python -c 'import sys; print(sys.version_info[0])')" == "2" && \
"$TRAVIS_PULL_REQUEST" == "false" && \
"$TRAVIS_BRANCH" == "master" && \
"$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then
./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
fi
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
if [[ "$TRAVIS_OS_NAME" == "linux" && \
"$(python -c 'import sys; print(sys.version_info[0])')" == "2" && \
"$TRAVIS_PULL_REQUEST" == "false" && \
"$TRAVIS_BRANCH" == "master" && \
"$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
fi