Skip to content

Commit dc15301

Browse files
authored
Switch from Heroku CI to GHA (heroku#1604)
* Remove unused env var * Parallel split test * Isolate environment modifying test These tests mutate ENV which was fine when they ran sequentially, but when they're run with parallel split tests we get failures on CI (but not locally) ``` 1) Rails Runner failure in one task does not cause another to fail Failure/Error: expect(!!local_storage.success?).to eq(true) expected: true got: false (compared using ==) Diff: @@ -1 +1 @@ -true +false # ./vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.3/lib/rspec/support.rb:110:in `block in <module:Support>' # ./vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.3/lib/rspec/support.rb:119:in `notify_failure' # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/fail_with.rb:35:in `fail_with' # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/handler.rb:37:in `handle_failure' # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/handler.rb:55:in `block in handle_matcher' # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/handler.rb:26:in `with_matcher' # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/handler.rb:47:in `handle_matcher' # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/expectation_target.rb:65:in `to' # ./vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.4/lib/rspec/expectations/expectation_target.rb:101:in `to' # ./spec/helpers/rails_runner_spec.rb:87:in `block (3 levels) in <top (required)>' # ./spec/helpers/rails_runner_spec.rb:10:in `block (2 levels) in wrap_test' # ./spec/helpers/rails_runner_spec.rb:9:in `chdir' # ./spec/helpers/rails_runner_spec.rb:9:in `block in wrap_test' # ./vendor/ruby-3.3.8/lib/ruby/3.3.0/tmpdir.rb:99:in `mktmpdir' # ./spec/helpers/rails_runner_spec.rb:8:in `wrap_test' ``` In theory the disk is already isolated, so I'm assuming the problem is with environment variable modification. * Try tests in GHA * Fix tests not running on GHA * Use Rails LTS creds * Remove unused file
1 parent 9cf1b8c commit dc15301

7 files changed

Lines changed: 40 additions & 61 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,28 @@ jobs:
2020
run: |
2121
shellcheck bin/support/bash_functions.sh bin/support/download_ruby -x &&
2222
shellcheck bin/compile bin/detect bin/release bin/test bin/test-compile -x
23+
24+
integration-test:
25+
runs-on: ubuntu-24.04
26+
env:
27+
HATCHET_APP_LIMIT: 300
28+
HATCHET_EXPENSIVE_MODE: 1
29+
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
30+
HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }}
31+
RAILS_LTS_CREDS: ${{ secrets.RAILS_LTS_CREDS }}
32+
HEROKU_DISABLE_AUTOUPDATE: 1
33+
PARALLEL_SPLIT_TEST_PROCESSES: 85
34+
RSPEC_RETRY_RETRY_COUNT: 1
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
- name: Install Ruby and dependencies
39+
uses: ruby/setup-ruby@v1
40+
with:
41+
bundler-cache: true
42+
ruby-version: "3.3.8"
43+
- name: Hatchet setup
44+
run: bundle exec hatchet ci:setup
45+
- name: Run Hatchet integration tests
46+
# parallel_split_test runs rspec in parallel, with concurrency equal to PARALLEL_SPLIT_TEST_PROCESSES.
47+
run: bundle exec parallel_split_test spec/

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ group :development, :test do
1010
gem "rspec-expectations"
1111
gem "excon"
1212
gem "rake"
13-
gem "parallel_tests"
13+
gem "parallel_split_test"
1414
gem 'rspec-retry'
1515
gem 'json'
1616
gem 'ci-queue'

Gemfile.lock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ GEM
2727
logger (1.7.0)
2828
moneta (1.0.0)
2929
multi_json (1.15.0)
30-
parallel (1.25.1)
31-
parallel_tests (4.7.1)
32-
parallel
30+
parallel (1.27.0)
31+
parallel_split_test (0.10.0)
32+
parallel (>= 0.5.13)
33+
rspec-core (>= 3.9.0)
3334
platform-api (3.8.0)
3435
heroics (~> 0.1.1)
3536
moneta (~> 1.0.0)
@@ -66,7 +67,7 @@ DEPENDENCIES
6667
excon
6768
heroku_hatchet
6869
json
69-
parallel_tests
70+
parallel_split_test
7071
rake
7172
redis
7273
rspec-core

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ To use this buildpack, fork it on Github. Push up changes to your fork, then cr
5050

5151
### Testing
5252

53-
The tests on this buildpack are written in Rspec to allow the use of
54-
`focused: true`. Parallelization of testing is provided by
55-
https://github.com/grosser/parallel_tests this lib spins up an arbitrary
56-
number of processes and running a different test file in each process,
57-
it does not parallelize tests within a test file. To run the tests: clone the repo, then `bundle install` then clone the test fixtures by running:
58-
5953
```sh
6054
$ bundle exec hatchet install
6155
```

app.json

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

spec/helpers/rails_runner_spec.rb

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
describe "Rails Runner" do
44
around(:each) do |test|
5-
original_path = ENV["PATH"]
6-
ENV["PATH"] = "./bin/:#{ENV['PATH']}"
7-
8-
Dir.mktmpdir do |tmpdir|
9-
Dir.chdir(tmpdir) do
10-
test.run
5+
# Process and disk isolation
6+
Hatchet::App.new("default_ruby").in_directory_fork do
7+
original_path = ENV["PATH"]
8+
ENV["PATH"] = "./bin/:#{ENV['PATH']}"
9+
10+
Dir.mktmpdir do |tmpdir|
11+
Dir.chdir(tmpdir) do
12+
test.run
13+
end
1114
end
1215
end
13-
ensure
14-
ENV["PATH"] = original_path if original_path
1516
end
1617

1718
it "config objects build propperly formatted commands" do
@@ -132,9 +133,5 @@ def to_s
132133
FileUtils.mkdir("bin")
133134
File.open("bin/rails", "w") { |f| f << executable_contents }
134135
File.chmod(0777, "bin/rails")
135-
136-
# BUILDPACK_LOG_FILE support for logging
137-
FileUtils.mkdir("tmp")
138-
FileUtils.touch("buildpack.log")
139136
end
140137
end

spec/spec_helper.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ def hatchet_path(path = "")
1919
end
2020

2121
RSpec.configure do |config|
22-
config.filter_run focused: true unless ENV['IS_RUNNING_ON_CI']
23-
config.run_all_when_everything_filtered = true
2422
config.alias_example_to :fit, focused: true
2523
config.full_backtrace = true
2624
config.verbose_retry = true # show retry status in spec process
27-
config.default_retry_count = 2 if ENV['IS_RUNNING_ON_CI'] # retry all tests that fail again
2825
config.example_status_persistence_file_path = 'spec/examples.txt'
2926

3027
config.expect_with :rspec do |c|

0 commit comments

Comments
 (0)