Skip to content

Commit dbc06ce

Browse files
committed
Merge pull request #1 from travis-ci/meat-artifacts-switch
Switch to using the artifacts addon
2 parents 76abb66 + df32f6b commit dbc06ce

File tree

3 files changed

+92
-24
lines changed

3 files changed

+92
-24
lines changed

.travis.yml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,28 @@ env:
1515
global:
1616
- VERSION='3.6-dev'
1717
- ALIAS='nightly'
18-
- INSTALL_DEST=/opt/python
19-
- PACKAGES='pip numpy nose pytest mock wheel'
2018

2119
install:
2220
- pushd /opt/pyenv/
2321
- sudo git checkout master
2422
- sudo git pull
2523
- popd
2624

27-
script:
28-
- pushd $HOME
29-
- sudo env PYTHON_BUILD_ROOT=/opt/pyenv/plugins/python-build /opt/pyenv/plugins/python-build/bin/python-build $VERSION $INSTALL_DEST/$VERSION
30-
- sudo ln -s $INSTALL_DEST/$VERSION $INSTALL_DEST/$ALIAS
31-
- virtualenv --distribute --python=$INSTALL_DEST/$VERSION/bin/python /home/travis/virtualenv/python$VERSION
32-
- ln -s $HOME/virtualenv/python$VERSION $HOME/virtualenv/python$ALIAS
33-
- $HOME/virtualenv/python$VERSION/bin/pip install --upgrade $PACKAGES
34-
- popd
25+
before_script:
26+
- 'export INSTALL_DEST=${INSTALL_DEST:-/opt/python}'
27+
- 'export LSB_RELEASE=${LSB_RELEASE:-$(lsb_release -rs)}'
28+
- 'export PACKAGES=${PACKAGES:-pip numpy nose pytest mock wheel}'
29+
30+
script: ./build-python
3531

36-
after_success:
37-
- mkdir -p $HOME/archive/$(lsb_release -rs)
38-
- tar cjf $HOME/archive/$(lsb_release -rs)/python-$ALIAS.tar.bz2 $INSTALL_DEST/$VERSION $INSTALL_DEST/$ALIAS $HOME/virtualenv/python$VERSION $HOME/virtualenv/python$ALIAS
39-
- ls -lh $HOME/archive/$(lsb_release -rs)/python-$ALIAS.tar.bz2
32+
after_success: ./create-archive
4033

4134
after_failure:
4235
- cat /tmp/python-build.*.log
4336

44-
deploy:
45-
provider: s3
46-
access_key_id: $ARTIFACTS_KEY
47-
secret_access_key: $ARTIFACTS_SECRET
48-
bucket: $ARTIFACTS_BUCKET
49-
local_dir: $HOME/archive/$(lsb_release -rs)
50-
upload_dir: $(lsb_release -rs)
51-
on:
52-
all_branches: true
53-
acl: public_read
37+
addons:
38+
artifacts:
39+
paths:
40+
- $LSB_RELEASE/
41+
target_paths:
42+
- /$LSB_RELEASE

build-python

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
5+
if [[ ! $INSTALL_DEST ]] ; then
6+
echo 'Missing INSTALL_DEST'
7+
exit 1
8+
fi
9+
10+
if [[ ! $VERSION ]] ; then
11+
echo 'Missing $VERSION'
12+
exit 1
13+
fi
14+
15+
set -o xtrace
16+
17+
sudo env PYTHON_BUILD_ROOT=/opt/pyenv/plugins/python-build \
18+
/opt/pyenv/plugins/python-build/bin/python-build $VERSION $INSTALL_DEST/$VERSION
19+
20+
if [[ $ALIAS ]] ; then
21+
sudo ln -s $INSTALL_DEST/$VERSION $INSTALL_DEST/$ALIAS
22+
fi
23+
24+
virtualenv --distribute --python=$INSTALL_DEST/$VERSION/bin/python \
25+
/home/travis/virtualenv/python$VERSION
26+
27+
if [[ $ALIAS ]] ; then
28+
ln -s $HOME/virtualenv/python$VERSION $HOME/virtualenv/python$ALIAS
29+
fi
30+
31+
if [[ $PACKAGES ]] ; then
32+
$HOME/virtualenv/python$VERSION/bin/pip install --upgrade $PACKAGES
33+
fi

create-archive

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
5+
if [[ ! $LSB_RELEASE ]] ; then
6+
echo 'Missing LSB_RELEASE'
7+
exit 1
8+
fi
9+
10+
if [[ ! $INSTALL_DEST ]] ; then
11+
echo 'Missing INSTALL_DEST'
12+
exit 1
13+
fi
14+
15+
if [[ ! $VERSION ]] ; then
16+
echo 'Missing VERSION'
17+
exit 1
18+
fi
19+
20+
set -o xtrace
21+
22+
: ${TAR_PATHS:=}
23+
: ${DEST:=${1}}
24+
25+
TAR_PATHS="$TAR_PATHS $INSTALL_DEST/$VERSION $HOME/virtualenv/python$VERSION"
26+
27+
if [[ $ALIAS ]] ; then
28+
TAR_PATHS="$TAR_PATHS $INSTALL_DEST/$ALIAS $HOME/virtualenv/python$ALIAS"
29+
DEST="$TRAVIS_BUILD_DIR/$LSB_RELEASE/python-${ALIAS}.tar.bz2"
30+
else
31+
if [[ ! $DEST ]] ; then
32+
DEST="$TRAVIS_BUILD_DIR/$LSB_RELEASE/python-${VERSION}.tar.bz2"
33+
fi
34+
fi
35+
36+
mkdir -p $(dirname $DEST)
37+
tar -cjf $DEST $TAR_PATHS
38+
39+
cd $(dirname $DEST) &>/dev/null
40+
41+
shopt -s nullglob
42+
for f in *.* ; do
43+
sha256sum $f > ${f}.sha256sum.txt
44+
done
45+
46+
echo "---> $DEST"

0 commit comments

Comments
 (0)