This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(travis): publish nightly builds off Travis-CI
- Loading branch information
Showing
14 changed files
with
295 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if [ -f "/opt/cirp/previous_runs_commit" ] && [ "$(cat /opt/cirp/previous_runs_commit)" == "$(git rev-parse HEAD)" ] | ||
then | ||
# No new commits in the repo | ||
touch /opt/cirp/previous_runs_commit | ||
git log -1 | ||
echo "No new commits in the repo" | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if [ ! -z "$TRAVIS_EVENT_TYPE" ] && [ "$TRAVIS_EVENT_TYPE" != "cron" ] | ||
then | ||
echo "Skipping publishing in a non-cron build" | ||
exit 0 | ||
fi | ||
|
||
if [ ! -z "$TRAVIS_PULL_REQUEST" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ] | ||
then | ||
echo "Skipping publishing in a Pull Request" | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
. .travis/cirp/check_precondition.sh | ||
. .travis/cirp/install.sh | ||
|
||
ci-release-publisher cleanup_publish | ||
ci-release-publisher cleanup_store --scope current-job previous-finished-builds \ | ||
--release complete incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
. .travis/cirp/check_precondition.sh | ||
. .travis/cirp/install.sh | ||
|
||
ci-release-publisher cleanup_store --scope current-build \ | ||
--release complete \ | ||
--on-nonallowed-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
. .travis/cirp/check_precondition.sh | ||
. .travis/cirp/install.sh | ||
|
||
ci-release-publisher cleanup_publish | ||
ci-release-publisher cleanup_store --scope current-build previous-finished-builds \ | ||
--release complete incomplete \ | ||
--on-nonallowed-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
. .travis/cirp/check_precondition.sh | ||
. .travis/cirp/install.sh | ||
|
||
ci-release-publisher cleanup_publish | ||
ci-release-publisher cleanup_store --scope current-build previous-finished-builds \ | ||
--release complete incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
. .travis/cirp/check_precondition.sh | ||
|
||
if [ -z "$TRAVIS_TEST_RESULT" ] && [ "$TRAVIS_TEST_RESULT" == "0" ] | ||
then | ||
echo "Build has not failed, skipping cleanup" | ||
exit 0 | ||
fi | ||
|
||
. .travis/cirp/install.sh | ||
|
||
ci-release-publisher cleanup_publish | ||
ci-release-publisher cleanup_store --scope current-build previous-finished-builds \ | ||
--release complete incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
. .travis/cirp/check_precondition.sh | ||
|
||
if [ ! -z "$TRAVIS_TEST_RESULT" ] && [ "$TRAVIS_TEST_RESULT" != "0" ] | ||
then | ||
echo "Build has failed, skipping publishing" | ||
exit 0 | ||
fi | ||
|
||
if [ "$#" != "1" ] | ||
then | ||
echo "Error: No arguments provided. Please specify a directory where to download artifacts to as the first argument." | ||
exit 1 | ||
fi | ||
|
||
ARTIFACTS_DIR="$1" | ||
|
||
. .travis/cirp/install.sh | ||
|
||
ci-release-publisher collect "$ARTIFACTS_DIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Install verifying the hash | ||
|
||
# Get Python >=3.5 | ||
if [ "$TRAVIS_OS_NAME" == "osx" ] | ||
then | ||
brew update | ||
|
||
# make sha256sum available | ||
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" | ||
|
||
brew upgrade python || true | ||
|
||
python --version || true | ||
python3 --version || true | ||
pyenv versions || true | ||
|
||
cd . | ||
cd "$(mktemp -d)" | ||
virtualenv env -p python3 | ||
set +u | ||
source env/bin/activate | ||
set -u | ||
cd - | ||
else | ||
python --version || true | ||
python3 --version || true | ||
pyenv versions || true | ||
|
||
pyenv global 3.6 | ||
fi | ||
|
||
pip install --upgrade pip | ||
|
||
check_sha256() | ||
{ | ||
if ! ( echo "$1 $2" | sha256sum -c --status - ) | ||
then | ||
echo "Error: sha256 of $2 doesn't match the known one." | ||
echo "Expected: $1 $2" | ||
echo -n "Got: " | ||
sha256sum "$2" | ||
exit 1 | ||
else | ||
echo "sha256 matches the expected one: $1" | ||
fi | ||
} | ||
|
||
# Don't install again if already installed. | ||
# OSX keeps re-installing it tough, as it uses a temp per-script virtualenv. | ||
if ! pip list --format=columns | grep '^ci-release-publisher ' | ||
then | ||
cd . | ||
cd "$(mktemp -d)" | ||
VERSION="0.1.0" | ||
FILENAME="ci_release_publisher-$VERSION-py3-none-any.whl" | ||
HASH="384bd9e2b0dd344381c01948e567bb26151636d6fd9b70fc58ef94aeb6be9466" | ||
pip download ci_release_publisher==$VERSION | ||
check_sha256 "$HASH" "$FILENAME" | ||
pip install --no-index --find-links "$PWD" "$FILENAME" | ||
cd - | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
. .travis/cirp/check_precondition.sh | ||
|
||
if [ ! -z "$TRAVIS_TEST_RESULT" ] && [ "$TRAVIS_TEST_RESULT" != "0" ] | ||
then | ||
echo "Build has failed, skipping publishing" | ||
exit 0 | ||
fi | ||
|
||
if [ "$#" != "1" ] | ||
then | ||
echo "Error: No arguments provided. Please specify a directory containing artifacts as the first argument." | ||
exit 1 | ||
fi | ||
|
||
ARTIFACTS_DIR="$1" | ||
|
||
. .travis/cirp/check_cache.sh | ||
|
||
. .travis/cirp/install.sh | ||
|
||
ci-release-publisher publish --latest-release \ | ||
--latest-release-prerelease \ | ||
--numbered-release \ | ||
--numbered-release-keep-count 3 \ | ||
--numbered-release-prerelease \ | ||
"$ARTIFACTS_DIR" | ||
|
||
. .travis/cirp/update_cache.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
. .travis/cirp/check_precondition.sh | ||
|
||
if [ ! -z "$TRAVIS_TEST_RESULT" ] && [ "$TRAVIS_TEST_RESULT" != "0" ] | ||
then | ||
echo "Build has failed, skipping publishing" | ||
exit 0 | ||
fi | ||
|
||
if [ "$#" != "1" ] | ||
then | ||
echo "Error: No arguments provided. Please specify a directory containing artifacts as the first argument." | ||
exit 1 | ||
fi | ||
|
||
ARTIFACTS_DIR="$1" | ||
|
||
. .travis/cirp/install.sh | ||
|
||
ci-release-publisher store "$ARTIFACTS_DIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if [ ! -z "$TRAVIS_TEST_RESULT" ] && [ "$TRAVIS_TEST_RESULT" != "0" ] | ||
then | ||
echo "Build has failed, skipping updating the cache" | ||
exit 0 | ||
fi | ||
|
||
mkdir -p /opt/cirp | ||
git rev-parse HEAD > /opt/cirp/previous_runs_commit |