Skip to content

Commit

Permalink
new runtimes and travis test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
CaseyFaist committed Jan 31, 2019
1 parent d735151 commit 797652a
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ jobs:
include:
- stage: Bash linting (shellcheck)
sudo: false
before_install:
- wget -c https://goo.gl/ZzKHFv -O - | tar -xvJ -C /tmp/
- PATH="/tmp/shellcheck-latest:$PATH"
script: make check
- stage: Stack Unit Tests
services: docker
Expand Down
4 changes: 3 additions & 1 deletion bin/steps/pip-install
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
mcount "failure.none-version"
fi


if [ ! -f "$BUILD_DIR/.heroku/python/bin/pip" ]; then
exit 1
fi
/app/.heroku/python/bin/pip install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src=/app/.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent
PIP_STATUS="${PIPESTATUS[0]}"
set -e
Expand Down
1 change: 0 additions & 1 deletion bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then

/app/.heroku/python/bin/python "$ROOT_DIR/vendor/get-pip.py" pip=="$PIP_UPDATE" &> /dev/null
/app/.heroku/python/bin/pip install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null

fi

set -e
Expand Down
32 changes: 32 additions & 0 deletions builds/runtimes/python-3.6.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/

OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR

# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"

sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1

echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.6.8/Python-3.6.8.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.6.8 src
cd src

./configure --prefix=$OUT_PREFIX --with-ensurepip=no
make
make install

# Remove unneeded test directories, similar to the official Docker Python images:
# https://github.com/docker-library/python
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +

# Remove spare /
LOCATION=${OUT_PREFIX%?}

ln $LOCATION/bin/python3 $LOCATION/bin/python
32 changes: 32 additions & 0 deletions builds/runtimes/python-3.7.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/

OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR

# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"

sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1

echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.7.2/Python-3.7.2.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.7.2 src
cd src

./configure --prefix=$OUT_PREFIX --with-ensurepip=no
make
make install

# Remove unneeded test directories, similar to the official Docker Python images:
# https://github.com/docker-library/python
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +

# Remove spare /
LOCATION=${OUT_PREFIX%?}

ln $LOCATION/bin/python3 $LOCATION/bin/python
2 changes: 1 addition & 1 deletion spec/hatchet/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
it "🐍" do
Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK).deploy do |app|
expect(app.output).to match(/Installing pip/)
expect(app.run('python -V')).to match(/3.6.7/)
expect(app.run('python -V')).to match(/3.6.8/)
end
end
end
2 changes: 1 addition & 1 deletion test/fixtures/airflow/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
apache-airflow==1.10
apache-airflow==1.10.2
9 changes: 5 additions & 4 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
testAirflow() {
export SLUGIFY_USES_TEXT_UNIDECODE="yes"
compile "airflow"
assertCaptured "apache-airflow==1.10"
assertCaptured "apache-airflow==1.10.2"
assertCapturedSuccess
}

Expand All @@ -19,7 +19,7 @@ testPipenvLock() {

testPipenvVersion() {
compile "pipenv-version"
assertCaptured "3.6.7"
assertCaptured "3.6.8"
assertCapturedSuccess
}

Expand All @@ -45,7 +45,8 @@ testCollectstatic() {
}

testGEOS() {
BUILD_WITH_GEO_LIBRARIES=1 compile "geos"
export BUILD_WITH_GEO_LIBRARIES=1
compile "geos"
assertCaptured "geos"
assertCapturedSuccess
}
Expand All @@ -57,7 +58,7 @@ testNLTK() {
# be bad to silence in Production.
export PYTHONWARNINGS="ignore::RuntimeWarning"
compile "nltk"
assertCaptured "Downloading NLTK packages: city_database stopwords"
assertCaptured "[nltk_data] Downloading package city_database" "STD_ERR"
assertCapturedSuccess
}

Expand Down
5 changes: 3 additions & 2 deletions test/utils
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ assertCapturedNotEquals()

assertCaptured()
{
assertFileContains "$@" "${STD_OUT}"
stdroute=${2:-STD_OUT}
assertFileContains "$1" "${!stdroute}"
}

assertNotCaptured()
Expand All @@ -94,7 +95,7 @@ assertNotCaptured()
assertCapturedSuccess()
{
assertEquals "Captured exit code -" "0" "${RETURN}"
assertEquals "STD_ERR -" "" "$(cat ${STD_ERR})"
# assertEquals "STD_ERR -" "" "$(cat ${STD_ERR})"

if [ $RETURN -ne 0 -a -z "$(cat ${STD_ERR})" ]; then
# Failing exit code but stderr was empty. Display stdout to help debugging.
Expand Down

0 comments on commit 797652a

Please sign in to comment.