diff options
author | Marco Trevisan <mail@3v1n0.net> | 2017-02-23 19:42:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-23 19:42:17 +0300 |
commit | c1d1b7b61e25547f0e7604603b71d80753e582da (patch) | |
tree | b988ba206f8ac96e737b6bc125a67301a1a18e07 | |
parent | a9514faf164f4d0f39e9ee2cdaf4003a5f0f1608 (diff) |
snap: optionally push all the built snaps on PRs to transfer.sh (#1126)
Snaps generated on PRs will be temporary uploaded
to transfer.sh, so that it will be easier to test the binaries.
-rw-r--r-- | .travis.yml | 1 | ||||
-rwxr-xr-x | scripts/travis-build.sh | 21 | ||||
-rw-r--r-- | snap/CMakeLists.txt | 11 |
3 files changed, 27 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml index af595819c..e97d7e5c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,7 @@ env: - DEB_BUILD_OPTIONS='-DCMAKE_BUILD_TYPE=Debug -DWITH_SSE2=ON -DWITH_APPINDICATOR=OFF' - DOCKER_IMAGE=ubuntu:xenial - SNAP_PRIME_ON_PULL_REQUEST=true + - SNAP_TRANSFER_SH_UPLOAD_ON_PULL_REQUEST=true - SNAP_UNSTABLE_CHANNEL=edge - SNAP_RELEASE_CHANNEL=stable - SNAPCRAFT_CONFIG_KEY=$encrypted_8816994192a9_key diff --git a/scripts/travis-build.sh b/scripts/travis-build.sh index a7b76837b..289873e0d 100755 --- a/scripts/travis-build.sh +++ b/scripts/travis-build.sh @@ -74,7 +74,7 @@ elif [ "$BUILD_TYPE" == "snap" ]; then docker run --name $DOCKER_BUILDER_NAME -v $PWD:$PWD -w $PWD -td $DOCKER_IMAGE elif [ "$TRAVIS_BUILD_STEP" == "install" ]; then docker_exec apt-get update -q - docker_exec apt-get install cmake git-core snapcraft -y + docker_exec apt-get install -y cmake git-core snapcraft elif [ "$TRAVIS_BUILD_STEP" == "script" ]; then git clean -f mkdir $BUILD_FOLDER @@ -87,12 +87,21 @@ elif [ "$BUILD_TYPE" == "snap" ]; then docker_exec make $make_target -C $BUILD_FOLDER elif [ "$TRAVIS_BUILD_STEP" == "after_success" ]; then - sudo mkdir -p $BUILD_FOLDER/snap/.snapcraft -m 777 set +x - openssl aes-256-cbc -K $SNAPCRAFT_CONFIG_KEY \ - -iv $SNAPCRAFT_CONFIG_IV \ - -in snap/.snapcraft/travis_snapcraft.cfg \ - -out $BUILD_FOLDER/snap/.snapcraft/snapcraft.cfg -d + if [ -n "$SNAPCRAFT_CONFIG_KEY" ] && [ -n "$SNAPCRAFT_CONFIG_IV" ]; then + sudo mkdir -p $BUILD_FOLDER/snap/.snapcraft -m 777 + openssl aes-256-cbc -K $SNAPCRAFT_CONFIG_KEY \ + -iv $SNAPCRAFT_CONFIG_IV \ + -in snap/.snapcraft/travis_snapcraft.cfg \ + -out $BUILD_FOLDER/snap/.snapcraft/snapcraft.cfg -d + fi + set -x + + if [ "$TRAVIS_PULL_REQUEST" != "false" ] && + [ "$SNAP_TRANSFER_SH_UPLOAD_ON_PULL_REQUEST" == "true" ]; then + docker_exec apt-get install -y curl + docker_exec make snap-push-transfer.sh -C $BUILD_FOLDER + fi elif [ "$TRAVIS_BUILD_STEP" == "deploy-unstable" ]; then docker_exec make snap-push-$SNAP_UNSTABLE_CHANNEL -C $BUILD_FOLDER elif [ "$TRAVIS_BUILD_STEP" == "deploy-release" ]; then diff --git a/snap/CMakeLists.txt b/snap/CMakeLists.txt index 0b2f76cd3..8ff9e7ad9 100644 --- a/snap/CMakeLists.txt +++ b/snap/CMakeLists.txt @@ -81,3 +81,14 @@ foreach(channel stable candidate beta edge) ) add_dependencies("snap-push-${channel}" "snap") endforeach(channel) + +add_custom_target("snap-push-transfer.sh" + COMMAND bash -c "snap=$(ls *.snap -1 | head -n1); \ + curl --upload-file $snap \ + https://transfer.sh/$(basename $snap)" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/snapcraft.yaml" + COMMENT "Create snap package ${SNAP_VERSION}" + VERBATIM + ) +add_dependencies("snap-push-transfer.sh" "snap") |