Skip to content

Commit

Permalink
Add heroku-24 to CI (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax authored Jul 3, 2024
1 parent 6f2e27d commit 6212541
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 35 deletions.
7 changes: 4 additions & 3 deletions .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_EXPENSIVE_MODE: 1
Expand Down Expand Up @@ -85,12 +85,13 @@ jobs:
name: "Unit Tests (${{ matrix.stack }})"
runs-on: ubuntu-22.04
container:
image: "${{ fromJson('{ \"heroku-20\": \"heroku/heroku:20\", \"heroku-22\": \"heroku/heroku:22\" }')[matrix.stack] }}"
image: "${{ fromJson('{ \"heroku-20\": \"heroku/heroku:20\", \"heroku-22\": \"heroku/heroku:22\", \"heroku-24\": \"heroku/heroku:24\" }')[matrix.stack] }}"
options: --user root
env:
STACK: ${{ matrix.stack }}
strategy:
matrix:
stack: ["heroku-20", "heroku-22"]
stack: ["heroku-20", "heroku-22", "heroku-24"]
steps:
- uses: actions/checkout@v4
- run: test/unit
23 changes: 2 additions & 21 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

assertCapturedSuccess() {
assertEquals 0 "${RETURN}"
if [ "$TRAVIS" = "true" ]; then
# Travis keeps injecting -Xmn option on JDK8 that causes a warning in STR_ERR
assertTrue true
else
assertEquals "" "$(cat ${STD_ERR})"
fi
}

setupJavaEnv() {
Expand All @@ -33,7 +27,7 @@ testCompileWithoutSystemProperties() {
assertCapturedSuccess

_assertMavenLatest
assertCaptured "Installing OpenJDK 1.8"
assertCaptured "Installing OpenJDK 21"
assertTrue "Java should be present in runtime." "[ -d ${BUILD_DIR}/.jdk ]"
assertTrue "Java version file should be present." "[ -f ${BUILD_DIR}/.jdk/version ]"
assertTrue "system.properties was not cached" "[ -f $CACHE_DIR/system.properties ]"
Expand All @@ -49,7 +43,7 @@ testCompile()

_assertMavenLatest
assertTrue "system.properties was not cached" "[ -f $CACHE_DIR/system.properties ]"
assertContains "system.properties contains the wrong version" "java.runtime.version=1.8" "$(cat $CACHE_DIR/system.properties)"
assertContains "system.properties contains the wrong version" "java.runtime.version=21" "$(cat $CACHE_DIR/system.properties)"
}

testCompilationFailure()
Expand Down Expand Up @@ -119,19 +113,6 @@ testCustomSettingsXmlWithUrl()
unset MAVEN_SETTINGS_URL
}

testCustomSettingsXmlWithInvalidUrl()
{
createPom

export MAVEN_SETTINGS_URL="https://example.com/ha7s8duysadfuhasjd/settings.xml"

compile

assertCapturedError

unset MAVEN_SETTINGS_URL
}

testIgnoreSettingsOptConfig()
{
createPom "$(withDependency)"
Expand Down
8 changes: 3 additions & 5 deletions test/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ EOF

createSettingsXml()
{
[ "$TRAVIS" = "true" ] && rm -rf /home/travis/.m2/repository

if [ ! -z "${1:-}" ]; then
settings_file="$1"
else
Expand Down Expand Up @@ -115,10 +113,10 @@ _assertMaven354() {

_assertMavenLatest() {
local installDir="$(_mavenDir)"
assertCaptured "Wrong Maven Installed" "Installing Maven 3.9.4"
assertCaptured "Installing Maven 3.9.4"
assertFileMD5 "45ca660e83af83fa8213b55fb693326c" ${installDir}/.maven/bin/mvn
assertTrue "mvn should be executable" "[ -x ${installDir}/.maven/bin/mvn ]"

assertCaptured "Unexpected mvn command" "mvn -DskipTests clean dependency:list install"
assertCaptured "Build was not successful" "BUILD SUCCESS"
assertCaptured "mvn -DskipTests clean dependency:list install"
assertCaptured "BUILD SUCCESS"
}
2 changes: 2 additions & 0 deletions test/spec/db_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Hatchet::Runner.new("java-apache-dbcp-sample", stack: ENV["HEROKU_TEST_STACK"]).tap do |app|
app.before_deploy do
set_java_version(DEFAULT_OPENJDK_VERSION)
app.add_database("heroku-postgresql")
`heroku addons:wait`
end

app.deploy do
Expand Down
4 changes: 2 additions & 2 deletions test/spec/fixtures/repos/java-apache-dbcp-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1102-jdbc41</version>
<version>42.7.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.0.1</version>
<version>2.12.0</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 2 additions & 0 deletions test/spec/java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
Hatchet::Runner.new("java-servlets-sample", stack: ENV["HEROKU_TEST_STACK"]).tap do |app|
app.before_deploy do
set_java_version(openjdk_version)
app.add_database("heroku-postgresql")
`heroku addons:wait`
end

app.deploy do
Expand Down
2 changes: 2 additions & 0 deletions test/spec/maven_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
app.before_deploy do
set_java_version(DEFAULT_OPENJDK_VERSION)
set_maven_version("3.2.5")
app.add_database("heroku-postgresql")
`heroku addons:wait`
end

app.deploy do
Expand Down
11 changes: 7 additions & 4 deletions test/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
require "hatchet"
require "java-properties"

# Omitting 1.7 here since most example projects used in testing are not
# compatible with 1.7.
OPENJDK_VERSIONS=%w(1.8 11 13 15)
OPENJDK_VERSIONS=%w(1.8 11)
DEFAULT_OPENJDK_VERSION="1.8"

RSpec.configure do |config|
Expand Down Expand Up @@ -50,5 +48,10 @@ def run(cmd)
def http_get(app, options = {})
retry_limit = options[:retry_limit] || 50
path = options[:path] ? "/#{options[:path]}" : ""
Excon.get("#{app.platform_api.app.info(app.name).fetch("web_url")}#{path}", :idempotent => true, :expects => 200, :retry_limit => retry_limit).body

begin
Excon.get("#{app.platform_api.app.info(app.name).fetch("web_url")}#{path}", :idempotent => true, :expects => 200, :retry_limit => retry_limit).body
rescue Excon::Error => e
puts e.response.body
end
end

0 comments on commit 6212541

Please sign in to comment.