mirror of https://github.com/BOINC/boinc.git
Travis: harmonize deploy scripts
On AppVeyor the archiving is done in prepare stage because they have an artefact cache for pull requests already available. So I moved the 7z stuff to prepare_deployment.sh so it does the same as the bath file. Filenames do not match because uploading to bintray is done differently but theyhave the same structure when available on bintray..
This commit is contained in:
parent
6e1050f7f8
commit
8cc9fc412c
|
@ -19,7 +19,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
## Push binaries to Bintray (https://bintray.com/docs/api/)
|
## Push binaries to Bintray (https://bintray.com/docs/api/)
|
||||||
## Creates a 7z archive from the content of $1
|
## Uploads a specific 7z archive from directory given by $1
|
||||||
|
## TODO: change arguments to include BOINC_TYPE and FILEPATH, eventually allow multiple files
|
||||||
|
|
||||||
# be carefull with set -x in this script because of ${BINTRAY_API_KEY} which needs to stay secret
|
# be carefull with set -x in this script because of ${BINTRAY_API_KEY} which needs to stay secret
|
||||||
set -e # Exit on errors
|
set -e # Exit on errors
|
||||||
|
@ -51,7 +52,7 @@ if [ "${BINTRAY_API_KEY}" == "" ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CI_RUN="${TRAVIS:-false}"
|
CI_RUN="${TRAVIS:-false}"
|
||||||
BOINC_TYPE="$(basename "${SOURCE_DIR}")"
|
BOINC_TYPE="$(basename "${SOURCE_DIR}")" # TODO: do not infer TYPE from directory, instead make it an argument
|
||||||
API=https://api.bintray.com
|
API=https://api.bintray.com
|
||||||
BINTRAY_USER="${BINTRAY_USER:-ChristianBeer}"
|
BINTRAY_USER="${BINTRAY_USER:-ChristianBeer}"
|
||||||
BINTRAY_API_KEY="$BINTRAY_API_KEY" # env
|
BINTRAY_API_KEY="$BINTRAY_API_KEY" # env
|
||||||
|
@ -74,6 +75,7 @@ if [[ $CI_RUN == "true" ]]; then
|
||||||
case $TRAVIS_EVENT_TYPE in
|
case $TRAVIS_EVENT_TYPE in
|
||||||
pull_request)
|
pull_request)
|
||||||
PKG_NAME="pull-requests"
|
PKG_NAME="pull-requests"
|
||||||
|
GIT_REV=${TRAVIS_PULL_REQUEST_SHA:0:8}
|
||||||
VERSION="PR${TRAVIS_PULL_REQUEST}_${BUILD_DATE}_${GIT_REV}"
|
VERSION="PR${TRAVIS_PULL_REQUEST}_${BUILD_DATE}_${GIT_REV}"
|
||||||
VERSION_DESC="CI build created from PR #${TRAVIS_PULL_REQUEST} on ${BUILD_DATE}"
|
VERSION_DESC="CI build created from PR #${TRAVIS_PULL_REQUEST} on ${BUILD_DATE}"
|
||||||
;;
|
;;
|
||||||
|
@ -108,19 +110,10 @@ data="{
|
||||||
set +x
|
set +x
|
||||||
${CURL} -H Content-Type:application/json -X POST -d "${data}" "${API}/packages/${BINTRAY_REPO_OWNER}/${BINTRAY_REPO}/${PKG_NAME}/versions"
|
${CURL} -H Content-Type:application/json -X POST -d "${data}" "${API}/packages/${BINTRAY_REPO_OWNER}/${BINTRAY_REPO}/${PKG_NAME}/versions"
|
||||||
|
|
||||||
echo "Uploading and publishing ${SOURCE_DIR}..."
|
echo "Uploading and publishing ${SOURCE_DIR}/${BOINC_TYPE}.7z..."
|
||||||
PKG_DIR=$(dirname "${SOURCE_DIR}")
|
if [ -f "${SOURCE_DIR}/${BOINC_TYPE}.7z" ]; then
|
||||||
cd "${PKG_DIR}"
|
|
||||||
7z a "${BOINC_TYPE}.7z" "${BOINC_TYPE}/" &>/dev/null
|
|
||||||
if [ $? -gt 1 ]; then # an exit code of 1 is still a success says 7z
|
|
||||||
cd ..
|
|
||||||
echo "error while creating 7z archive; files not uploaded"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
cd "${ROOTDIR}"
|
|
||||||
if [ -f "${PKG_DIR}/${BOINC_TYPE}.7z" ]; then
|
|
||||||
set +x
|
set +x
|
||||||
${CURL} -H Content-Type:application/octet-stream -T "${PKG_DIR}/${BOINC_TYPE}.7z" "${API}/content/${BINTRAY_REPO_OWNER}/${BINTRAY_REPO}/${PKG_NAME}/${VERSION}/${BOINC_TYPE}_${VERSION}.7z?publish=1&override=1"
|
${CURL} -H Content-Type:application/octet-stream -T "${SOURCE_DIR}/${BOINC_TYPE}.7z" "${API}/content/${BINTRAY_REPO_OWNER}/${BINTRAY_REPO}/${PKG_NAME}/${VERSION}/${BOINC_TYPE}_${VERSION}.7z?publish=1&override=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TRAVIS_BUILD_ID" ] ; then
|
if [ "$TRAVIS_BUILD_ID" ] ; then
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
## BOINC_TYPE should always be consistent with content in .travis.yml and appveyor.yml
|
## BOINC_TYPE should always be consistent with content in .travis.yml and appveyor.yml
|
||||||
## Change artefacts in each prepare_*() function below.
|
## Change artefacts in each prepare_*() function below.
|
||||||
## Don't hardlink files because this can be run on a filesystem without hardlinks
|
## Don't hardlink files because this can be run on a filesystem without hardlinks
|
||||||
## Don't put files into a zip as this is done by the actual deployment script
|
|
||||||
## On error always exit non-zero so the deploy script does not run
|
## On error always exit non-zero so the deploy script does not run
|
||||||
|
|
||||||
# check working directory because the script needs to be called like: ./deploy/prepare_deployment.sh
|
# check working directory because the script needs to be called like: ./deploy/prepare_deployment.sh
|
||||||
|
@ -31,6 +30,7 @@ if [ ! -d "deploy" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ROOTDIR=$(pwd)
|
||||||
# main funtion is at the end
|
# main funtion is at the end
|
||||||
|
|
||||||
cp_if_exists() {
|
cp_if_exists() {
|
||||||
|
@ -39,11 +39,26 @@ cp_if_exists() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepare_7z_archive() {
|
||||||
|
if [[ $(ls -A "${TARGET_DIR}" | wc -l) -eq 0 ]]; then
|
||||||
|
echo "Directory '$TARGET_DIR' is empty";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
cd "${TARGET_DIR}"
|
||||||
|
7z a "${TYPE}.7z" '-x!*.7z' '*' &>/dev/null
|
||||||
|
if [ $? -gt 1 ]; then # an exit code of 1 is still a success says 7z
|
||||||
|
cd ${ROOTDIR}
|
||||||
|
echo "error while creating 7z archive; files not uploaded"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
prepare_client() {
|
prepare_client() {
|
||||||
mkdir -p "${TARGET_DIR}"
|
mkdir -p "${TARGET_DIR}"
|
||||||
cp_if_exists client/boinc "${TARGET_DIR}"
|
cp_if_exists client/boinc "${TARGET_DIR}"
|
||||||
cp_if_exists client/boinccmd "${TARGET_DIR}"
|
cp_if_exists client/boinccmd "${TARGET_DIR}"
|
||||||
cp_if_exists client/switcher "${TARGET_DIR}"
|
cp_if_exists client/switcher "${TARGET_DIR}"
|
||||||
|
prepare_7z_archive
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_apps() {
|
prepare_apps() {
|
||||||
|
@ -59,11 +74,13 @@ prepare_apps() {
|
||||||
cp_if_exists samples/vboxwrapper/vboxwrapper "${TARGET_DIR}"
|
cp_if_exists samples/vboxwrapper/vboxwrapper "${TARGET_DIR}"
|
||||||
cp_if_exists samples/worker/worker "${TARGET_DIR}"
|
cp_if_exists samples/worker/worker "${TARGET_DIR}"
|
||||||
cp_if_exists samples/wrapper/wrapper "${TARGET_DIR}"
|
cp_if_exists samples/wrapper/wrapper "${TARGET_DIR}"
|
||||||
|
prepare_7z_archive
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_manager() {
|
prepare_manager() {
|
||||||
mkdir -p "${TARGET_DIR}"
|
mkdir -p "${TARGET_DIR}"
|
||||||
cp_if_exists clientgui/boincmgr "${TARGET_DIR}"
|
cp_if_exists clientgui/boincmgr "${TARGET_DIR}"
|
||||||
|
prepare_7z_archive
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_apps_mingw() {
|
prepare_apps_mingw() {
|
||||||
|
|
Loading…
Reference in New Issue