From 214d09891909ce5505d7bdbc5c848a9c4be23c0d Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Tue, 8 Mar 2016 20:33:21 +0100 Subject: travis: added script to upload distfiles --- .gitignore | 6 +++-- .travis.yml | 15 +++++++++++- Makefile.am | 1 - build-aux/build-travis.sh | 45 ----------------------------------- build-aux/build-windows.sh | 48 ------------------------------------- build-aux/travis-build.sh | 47 ++++++++++++++++++++++++++++++++++++ build-aux/travis-deploy.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 124 insertions(+), 97 deletions(-) delete mode 100755 build-aux/build-travis.sh delete mode 100755 build-aux/build-windows.sh create mode 100755 build-aux/travis-build.sh create mode 100755 build-aux/travis-deploy.sh diff --git a/.gitignore b/.gitignore index 33a6ebf..48f0735 100644 --- a/.gitignore +++ b/.gitignore @@ -32,9 +32,9 @@ Makefile.in /stamp-h1 .dirstamp /build-aux/* -!/build-aux/build-travis.sh -!/build-aux/build-windows.sh !/build-aux/git-version-gen +!/build-aux/travis-build.sh +!/build-aux/travis-deploy.sh # installed .m4 files /m4/*.m4 @@ -67,3 +67,5 @@ blogc-*.rpm # git-version-gen /.version + +/build/ diff --git a/.travis.yml b/.travis.yml index a32e4e1..9645b60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,11 @@ env: - TARGET=w32 - TARGET=w64 +global: + - secure: JCF5qRCiY+z7jwfCamG3v5xgQZ82MVvQPee6E3zhxMa6psp1wtPRJNx9MvXQxtjAvnOdHav5Ivo29JYFtxVdrzEM/J/R3FKRmgZ71nCw9Mf/iVjIrRHwW3ofQJ9sCwbWZi1tha7yD12qGlxDKA0cAwVuRpHy/MQDiBAmZxN7XCw= + - secure: YBCsXkVyv43DadU2xiplVPFZBRb4HXpb815he6672ESuoh5VAtIrRH7UlI5z/7BLtSv0Isb2X5rBlTWAzNM8y/Ec0cYlBlmMIBWdl2CvQQSZ8x+kIK0hkADzQboU0E7ZUw13xca1R3C88UpSKH69M8AUJpj+VPgEOT1NE+M9pfw= + - secure: Ct5BdBhRsa3cjJnPUQ48NdJR6Ih2GIJiUdJFhLxxRX4nEudVDfqFB1OOwTtbPO3/RBtPDEL8BzdnZzs7BDOOJKTpoljY4GyC7LsknNVAztWrIV9vh3K6c3UijPzIcoOxGFIPPvzAm37zyS4kzMP2+7r2mZjvr1TvmXlSL59Rruw= + matrix: exclude: - compiler: clang @@ -35,4 +40,12 @@ install: gem install ronn before_script: ./autogen.sh -script: ./build-aux/build-travis.sh +script: ./build-aux/travis-build.sh + +deploy: + provider: script + script: ./build-aux/travis-deploy.sh + skip_cleanup: true + on: + repo: blogc/blogc + branch: master diff --git a/Makefile.am b/Makefile.am index 1c5388d..9554599 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,6 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ ## File listings EXTRA_DIST = \ - build-aux/build-windows.sh \ build-aux/git-version-gen \ $(top_srcdir)/.version \ autogen.sh \ diff --git a/build-aux/build-travis.sh b/build-aux/build-travis.sh deleted file mode 100755 index d400494..0000000 --- a/build-aux/build-travis.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -set -ex - -rm -rf build -mkdir -p build - -MAKE_TARGET="${TARGET}" - -if [[ "x${TARGET}" = xw* ]]; then - unset CC - export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" - export CHOST="x86_64-w64-mingw32" - test "x${TARGET}" = "xw32" && export CHOST="i686-w64-mingw32" - MAKE_TARGET="all" -else - export CFLAGS="-Wall -g" - export CONFIGURE_ARGS="--enable-tests --enable-valgrind" -fi - -pushd build > /dev/null - -../configure \ - ${CHOST:+--host=${CHOST} --target=${CHOST}} \ - --enable-ronn \ - --disable-silent-rules \ - ${CONFIGURE_ARGS} - -popd > /dev/null - -make -C build "${MAKE_TARGET}" - -if [[ "x${TARGET}" = xw* ]]; then - VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)" - DEST_DIR="blogc-${VERSION}-${TARGET}" - - rm -rf "${DEST_DIR}" - mkdir -p "${DEST_DIR}" - - cp build/.libs/blogc.exe "${DEST_DIR}/" - cp LICENSE "${DEST_DIR}/" - cp README.md "${DEST_DIR}/" - - zip "${DEST_DIR}.zip" "${DEST_DIR}"/* -fi diff --git a/build-aux/build-windows.sh b/build-aux/build-windows.sh deleted file mode 100755 index bdecc8b..0000000 --- a/build-aux/build-windows.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# This script builds windows binaries, given a source tarball. -# It was designed to work on Fedora, and requires the following packages: -# -# mingw32-gcc mingw64-gcc zip -# -# This script must be called with the xz source tarball and the target version -# as arguments. - - -set -ex - -[[ $# -eq 2 ]] - - -build() { - local version=${2} - local arch=${3} - local build_dir="/tmp/blogc_build_${version}_${arch}" - local dest_dir="/tmp/blogc-${version}-w${arch}" - - rm -rf "${build_dir}" - mkdir -p "${build_dir}" - tar -xvf "${1}" -C "${build_dir}" - - pushd "${build_dir}/blogc-${version}" &> /dev/null - "mingw${arch}-configure" - make - popd &> /dev/null - - rm -rf "${dest_dir}" - mkdir -p "${dest_dir}" - cp "${build_dir}/blogc-${version}/.libs/blogc.exe" "${dest_dir}/" - cp "${build_dir}/blogc-${version}/LICENSE" "${dest_dir}/" - cp "${build_dir}/blogc-${version}/README.md" "${dest_dir}/" - - pushd "$(dirname ${dest_dir})" &> /dev/null - zip "$(basename ${dest_dir}).zip" "$(basename ${dest_dir})"/* - popd &> /dev/null - - mv "${dest_dir}.zip" . -} - - -for arch in 32 64; do - build "$1" "$2" "${arch}" -done diff --git a/build-aux/travis-build.sh b/build-aux/travis-build.sh new file mode 100755 index 0000000..d03cafd --- /dev/null +++ b/build-aux/travis-build.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +set -ex + +rm -rf build +mkdir -p build + +MAKE_TARGET="${TARGET}" + +if [[ "x${TARGET}" = xw* ]]; then + unset CC + export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" + export CHOST="x86_64-w64-mingw32" + [[ "x${TARGET}" = "xw32" ]] && export CHOST="i686-w64-mingw32" + MAKE_TARGET="all" +else + export CFLAGS="-Wall -g" + export CONFIGURE_ARGS="--enable-tests --enable-valgrind" +fi + +pushd build > /dev/null + +../configure \ + ${CHOST:+--host=${CHOST} --target=${CHOST}} \ + --enable-ronn \ + --with-squareball=internal \ + --disable-silent-rules \ + ${CONFIGURE_ARGS} + +popd > /dev/null + +make -C build "${MAKE_TARGET}" + +if [[ "x${TARGET}" = xw* ]]; then + TARNAME="$(grep PACKAGE_TARNAME build/config.h | cut -d\" -f2)" + VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)" + DEST_DIR="${TARNAME}-${VERSION}-${TARGET}" + + rm -rf "${DEST_DIR}" + mkdir -p "${DEST_DIR}" + + cp build/.libs/blogc.exe "${DEST_DIR}/" + cp LICENSE "${DEST_DIR}/" + cp README.md "${DEST_DIR}/" + + zip "build/${DEST_DIR}.zip" "${DEST_DIR}"/* +fi diff --git a/build-aux/travis-deploy.sh b/build-aux/travis-deploy.sh new file mode 100755 index 0000000..267c8d5 --- /dev/null +++ b/build-aux/travis-deploy.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +set -e + +if [[ "x${TARGET}" != xw* ]] && [[ "x${TARGET}" != xdist* ]]; then + echo "Nothing to deploy." + exit 0 +fi + +if [[ ! -d build ]]; then + echo "Build directory not found." + exit 1 +fi + +if [[ "x${TARGET}" = xw* ]]; then + FILES=( build/*.zip ) +elif [[ "x${TARGET}" = "xdist-srpm" ]]; then + FILES=( build/*.src.rpm ) +else + FILES=( build/*.{*.tar.{gz,bz2,xz},zip} ) +fi + +TARNAME="$(grep PACKAGE_TARNAME build/config.h | cut -d\" -f2)" +VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)" + +do_curl() { + curl \ + --silent \ + --ftp-create-dirs \ + --upload-file "${1}" \ + --user "${FTP_USER}:${FTP_PASSWORD}" \ + "ftp://${FTP_HOST}/public_html/${TARNAME}/${TARNAME}-${VERSION}/$(basename ${1})" +} + +echo " * Found files:" +for f in "${FILES[@]}"; do + echo " $(basename ${f})" +done +echo + +for f in "${FILES[@]}"; do + echo " * Processing file: $(basename ${f}):" + + echo -n " Generating SHA512 checksum ... " + pushd build > /dev/null + sha512sum "$(basename ${f})" > "$(basename ${f}).sha512" + popd > /dev/null + echo "done" + + echo -n " Uploading file ... " + do_curl "${f}" + echo "done" + + echo -n " Uploading SHA512 checksum ... " + do_curl "${f}.sha512" + echo "done" + + echo +done -- cgit v1.2.3-18-g5258