Skip to content

Commit e10d300

Browse files
authored
Update GHA CI and remove shunit tests (#189)
1 parent 633443a commit e10d300

File tree

6 files changed

+29
-144
lines changed

6 files changed

+29
-144
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,26 @@ permissions:
1010
contents: read
1111

1212
jobs:
13+
lint:
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v6
18+
- name: Install Ruby and dependencies
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
bundler-cache: true
22+
ruby-version: "3.4"
23+
- name: Install shfmt
24+
run: sudo apt-get install shfmt
25+
- run: make lint-scripts
26+
- run: make check-format
27+
- run: make lint-ruby
28+
1329
hatchet:
1430
name: "Hatchet (${{ matrix.stack }})"
1531
runs-on: ubuntu-22.04
32+
needs: lint
1633
strategy:
1734
fail-fast: false
1835
matrix:
@@ -42,42 +59,3 @@ jobs:
4259
run: bundle exec hatchet ci:setup
4360
- name: Run Hatchet integration tests
4461
run: bundle exec parallel_split_test test/spec/
45-
46-
buildpack-testrunner:
47-
runs-on: ubuntu-22.04
48-
env:
49-
SHUNIT_HOME: /tmp/shunit2-2.1.6
50-
# Note the missing STACK environment variable here. This works since there is a default value in the buildpack
51-
# source. I ported this as-is from the Travis config. Given we're trying to get rid of testrunner entirely,
52-
# it will stay like this. If we, for some reason, decide to keep testrunner, we should look into a fixed STACK env var.
53-
steps:
54-
- uses: actions/checkout@v6
55-
- uses: actions/setup-java@v5
56-
with:
57-
distribution: zulu
58-
java-version: 8
59-
- name: Download and unpack shunit 2.1.6
60-
run: curl -sSf --retry 3 --retry-connrefused --connect-timeout 5 https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz | tar xz -C /tmp/
61-
- name: Clone heroku-buildpack-testrunner
62-
run: git clone https://github.com/heroku/heroku-buildpack-testrunner.git /tmp/testrunner
63-
- name: Apply heroku-buildpack-testrunner patches to enforce bash shell
64-
run: |
65-
cd /tmp/testrunner
66-
git apply <<'EOF'
67-
diff --git a/bin/run b/bin/run
68-
index 0d5b790..a0ff25c 100755
69-
--- a/bin/run
70-
+++ b/bin/run
71-
@@ -101,7 +101,7 @@ for bp in ${@}; do
72-
suite_start_time="$(date +%s)"
73-
74-
echo " TEST SUITE: $(basename ${f})"
75-
- ${SHUNIT_HOME?"'SHUNIT_HOME' environment variable must be set"}/src/shunit2 ${f} | indent
76-
+ /bin/bash ${SHUNIT_HOME?"'SHUNIT_HOME' environment variable must be set"}/src/shunit2 ${f} | indent
77-
exit_code=$(max ${exit_code} ${PIPESTATUS[0]})
78-
79-
suite_end_time="$(date +%s)"
80-
81-
EOF
82-
- name: Execute buildpack-testrunner
83-
run: /tmp/testrunner/bin/run .

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.PHONY: lint lint-scripts lint-ruby check-format format run publish
33

44
STACK ?= heroku-24
5-
FIXTURE ?= test/spec/fixtures/repos/clojure-minimal
5+
FIXTURE ?= test/spec/fixtures/repos/lein-2.x-with-uberjar
66

77
# Converts a stack name of `heroku-NN` to its build Docker image tag of `heroku/heroku:NN-build`.
88
STACK_IMAGE_TAG := heroku/$(subst -,:,$(STACK))-build

test/lein_test.sh

Lines changed: 0 additions & 97 deletions
This file was deleted.

test/spec/compile_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,13 @@
332332
it 'uses custom bin/build script when present' do
333333
new_default_hatchet_runner('lein-2.x-with-uberjar').tap do |app|
334334
app.before_deploy do
335-
Dir.mkdir('bin') unless Dir.exist?('bin')
335+
FileUtils.mkdir_p('bin')
336336
File.write('bin/build', <<~SCRIPT)
337337
#!/usr/bin/env bash
338338
echo "Running custom build script"
339339
lein deps
340340
SCRIPT
341-
File.chmod(0755, 'bin/build')
341+
File.chmod(0o755, 'bin/build')
342342
end
343343

344344
app.deploy do
@@ -353,14 +353,14 @@
353353
buildpack_root = File.expand_path('../..', __dir__)
354354
new_default_hatchet_runner('lein-2.x-with-uberjar').tap do |app|
355355
app.before_deploy do
356-
Dir.mkdir('bin') unless Dir.exist?('bin')
356+
FileUtils.mkdir_p('bin')
357357
# Create a working lein script based on opt/lein2
358358
lein_template_path = File.join(buildpack_root, 'opt/lein2')
359359
lein_content = File.read(lein_template_path)
360360
# Replace the version placeholder with actual version
361361
lein_content.gsub!('##LEIN_VERSION##', '2.9.1')
362362
File.write('bin/lein', lein_content)
363-
File.chmod(0755, 'bin/lein')
363+
File.chmod(0o755, 'bin/lein')
364364
end
365365

366366
app.deploy do

test/spec/runtime_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030

3131
# Verify lein is available
3232
lein_output = app.run('lein version')
33-
expect(lein_output).to match(/Downloading Leiningen to \/app\/\.lein\/self-installs\/leiningen-\d+\.\d+\.\d+-standalone\.jar now\.\.\./)
33+
expect(lein_output).to match(
34+
%r{Downloading Leiningen to /app/\.lein/self-installs/leiningen-\d+\.\d+\.\d+-standalone\.jar now\.\.\.}
35+
)
3436
expect(lein_output).to match(/Leiningen \d+\.\d+\.\d+ on Java \d+\.\d+\.\d+ OpenJDK 64-Bit Server VM/)
3537
end
3638
end

test/spec/spec_helper.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def http_get(app, options = {})
4343
retry_limit = options[:retry_limit] || 50
4444
path = options[:path] ? "/#{options[:path]}" : ''
4545
Excon.get("#{app.platform_api.app.info(app.name).fetch('web_url')}#{path}", idempotent: true, expects: 200,
46-
retry_limit: retry_limit).body
46+
retry_limit: retry_limit).body
4747
end
4848

4949
def find_output_start_index(lines)
@@ -62,6 +62,7 @@ def find_output_end_index(lines)
6262
[success_end_index, failure_end_index].compact.first
6363
end
6464

65+
# rubocop:disable Metrics/MethodLength, Layout/LineLength
6566
def clean_output(output)
6667
# Remove output from the build system before and after the actual build
6768
lines = output.lines
@@ -95,7 +96,7 @@ def clean_output(output)
9596
# Clojure / Leiningen
9697
##################################################
9798
# Maven/Leiningen dependency retrieval (normalize non-deterministic download order)
98-
/Retrieving [\w\/\.\-]+\.(pom|jar) from \w+/ => 'Retrieving $DEPENDENCY from $REPO',
99+
%r{Retrieving [\w/.-]+\.(pom|jar) from \w+} => 'Retrieving $DEPENDENCY from $REPO',
99100
# Jetty logging timestamp
100101
/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+:INFO::main: Logging initialized @\d+ms/ => '$TIMESTAMP:INFO::main: Logging initialized @$TIMEms',
101102

@@ -115,3 +116,4 @@ def clean_output(output)
115116

116117
output
117118
end
119+
# rubocop:enable Metrics/MethodLength, Layout/LineLength

0 commit comments

Comments
 (0)