Skip to content

Commit

Permalink
Add heroku-24 to CI (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax committed Jun 5, 2024
1 parent 563b79a commit df0e62e
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
stack: ["heroku-20", "heroku-22"]
stack: ["heroku-20", "heroku-22", "heroku-24"]
env:
HATCHET_APP_LIMIT: 100
HATCHET_RUN_MULTI: 1
Expand Down
88 changes: 2 additions & 86 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh

DEFAULT_SBT_VERSION="0.13.17"
DEFAULT_PLAY_VERSION="2.3.4"
DEFAULT_SCALA_VERSION="2.12.7"
DEFAULT_SBT_VERSION="1.10.0"
DEFAULT_SCALA_VERSION="2.13.14"
SBT_TEST_CACHE="/tmp/sbt-test-cache"
SBT_STAGING_STRING="THIS_STRING_WILL_BE_OUTPUT_DURING_STAGING"

Expand Down Expand Up @@ -37,73 +36,10 @@ sbt.version=${sbtVersion}
EOF
}

_primeSbtTestCache()
{
local sbtVersion=${1:-${DEFAULT_SBT_VERSION}}

# exit code of app compile is cached so it is consistant between runn
local compileStatusFile=${SBT_TEST_CACHE}/${sbtVersion}/app/compile_status

if [ ! -f ${compileStatusFile} ]; then
[ -d ${SBT_TEST_CACHE}/${sbtVersion} ] && rm -r ${SBT_TEST_CACHE}/${sbtVersion}

ORIGINAL_BUILD_DIR=${BUILD_DIR}
ORIGINAL_CACHE_DIR=${CACHE_DIR}

BUILD_DIR=${SBT_TEST_CACHE}/${sbtVersion}/app/build
CACHE_DIR=${SBT_TEST_CACHE}/${sbtVersion}/app/cache
mkdir -p ${BUILD_DIR} ${CACHE_DIR}

_createSbtProject ${sbtVersion} ${BUILD_DIR}
${BUILDPACK_HOME}/bin/compile ${BUILD_DIR} ${CACHE_DIR} >/dev/null 2>&1
echo "$?" > ${compileStatusFile}

BUILD_DIR=${ORIGINAL_BUILD_DIR}
CACHE_DIR=${ORIGINAL_CACHE_DIR}
fi

return $(cat ${compileStatusFile})
}

_primeIvyCache()
{
local sbtVersion=${1:-${DEFAULT_SBT_VERSION}}

ivy2_path=.sbt_home/.ivy2
mkdir -p ${CACHE_DIR}/${ivy2_path}
_primeSbtTestCache ${sbtVersion} && cp -r ${SBT_TEST_CACHE}/${sbtVersion}/app/cache/${ivy2_path}/cache ${CACHE_DIR}/${ivy2_path}
}

createPlayProject()
{
local playVersion=${1:-${DEFAULT_PLAY_VERSION}}
local sbtVersion=${2:-${DEFAULT_SBT_VERSION}}
local scalaVersion=${3:-${DEFAULT_SCALA_VERSION}}

mkdir -p ${BUILD_DIR}/conf ${BUILD_DIR}/project
touch ${BUILD_DIR}/conf/application.conf
cat > ${BUILD_DIR}/project/plugins.sbt <<EOF
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "${playVersion}")
EOF

cat > ${BUILD_DIR}/build.sbt <<EOF
scalaVersion := "${scalaVersion}"
TaskKey[Unit]("stage") in Compile := { println("${SBT_STAGING_STRING}") }
EOF

cat > ${BUILD_DIR}/project/build.properties <<EOF
sbt.version=${sbtVersion}
EOF
}

createSbtProject()
{
local sbtVersion=${1:-${DEFAULT_SBT_VERSION}}

_primeIvyCache ${sbtVersion}
_createSbtProject ${sbtVersion}
}

Expand All @@ -114,8 +50,6 @@ testCompile()
createSbtProject

# create `testfile`s in CACHE_DIR and later assert `compile` copied them to BUILD_DIR
mkdir -p ${CACHE_DIR}/.sbt_home/.ivy2
touch ${CACHE_DIR}/.sbt_home/.ivy2/testfile
mkdir -p ${CACHE_DIR}/.sbt_home/bin
touch ${CACHE_DIR}/.sbt_home/bin/testfile

Expand All @@ -128,7 +62,6 @@ testCompile()
assertEquals 0 "${RETURN}"

# setup
assertTrue "Ivy2 cache should have been repacked." "[ -d ${BUILD_DIR}/.sbt_home/.ivy2 ]"
assertTrue "SBT bin cache should have been unpacked" "[ -f ${BUILD_DIR}/.sbt_home/bin/testfile ]"
assertFalse "Old SBT launch jar should have been deleted" "[ -f ${BUILD_DIR}/.sbt_home/bin/sbt-launch-OLD.jar ]"
assertTrue "sbt launch script should be created" "[ -f ${BUILD_DIR}/.sbt_home/bin/sbt ]"
Expand All @@ -143,14 +76,12 @@ testCompile()
assertTrue "system.properties was not cached" "[ -f $CACHE_DIR/system.properties ]"

# clean up
assertEquals "Ivy2 cache should have been repacked for a non-play project" "" "$(diff -r ${BUILD_DIR}/.sbt_home/.ivy2 ${CACHE_DIR}/.sbt_home/.ivy2)"
assertEquals "SBT home should have been repacked" "" "$(diff -r ${BUILD_DIR}/.sbt_home/bin ${CACHE_DIR}/.sbt_home/bin)"

# re-deploy
compile

assertEquals 0 "${RETURN}"
assertNotCaptured "Ivy cache should not be primed on re-run" "Priming Ivy Cache"
assertNotCaptured "SBT should not be re-installed on re-run" "Building app with sbt"

# Something is wrong with incremental compile
Expand All @@ -173,27 +104,12 @@ testCleanCompile()
assertCaptured "SBT tasks to run should still be outputed" "Running: sbt clean compile stage"
}

testRemovePlayForkRun()
{
createPlayProject "2.3.10" "0.13.17" "2.10.7"
mkdir -p ${BUILD_DIR}/project
touch ${BUILD_DIR}/project/play-fork-run.sbt

compile

assertEquals 0 "${RETURN}"
#assertCaptured "Warns about play-fork-run removal" "Removing project/play-fork-run.sbt."
assertFalse "Removes play-fork-run" "[ -f ${BUILD_DIR}/project/play-fork-run.sbt ]"
}

testCompile_Play20Project() {
createSbtProject
mkdir -p ${BUILD_DIR}/conf
touch ${BUILD_DIR}/conf/application.conf
compile
assertEquals 0 "${RETURN}"
assertTrue "Ivy2 cache should have been repacked for a play project." "[ -d ${CACHE_DIR}/.sbt_home/.ivy2 ]"
assertFalse "Ivy2 cache should not have been included in slug for a play project." "[ -d ${BUILD_DIR}/.sbt_home/.ivy2 ]"
assertFalse "Streams should not have been included in slug for a play project." "[ -d ${BUILD_DIR}/target/streams ]"
assertFalse "Scala cache should not have been included in slug for a play project." "[ -d ${BUILD_DIR}/target/scala-2.9.1 ]"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java.runtime.version=8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java.runtime.version=8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java.runtime.version=8
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java.runtime.version=1.7
java.runtime.version=8
1 change: 1 addition & 0 deletions test/spec/fixtures/repos/sbt-one-example/system.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java.runtime.version=8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java.runtime.version=8

0 comments on commit df0e62e

Please sign in to comment.