Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
prebake (0.3.4)
prebake (0.3.5)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -91,7 +91,7 @@ CHECKSUMS
mocha (3.1.0) sha256=75f42d69ebfb1f10b32489dff8f8431d37a418120ecdfc07afe3bc183d4e1d56
parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970
parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
prebake (0.3.4)
prebake (0.3.5)
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ When `PREBAKE_PUSH_ENABLED=true` (for self-hosted setups):
3. The gem and checksum are uploaded to the backend in the background.
4. Future `bundle install` runs by anyone on the same platform get the precompiled version.

A gem compiled with build options is never published. Everyone on the same platform would receive it as the default build of that gem, so only gems compiled with default options are uploaded.

## Supported platforms (cloud service)

| Platform | Architecture | OS |
Expand Down
2 changes: 2 additions & 0 deletions lib/prebake/async_publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def self.wait_for_completion(timeout: 120)
end

def self.build_gem(spec, backend)
return nil unless spec.build_args.empty? # consumers expect a cache entry to be a default build

platform = Platform.generalized
cache_key = CacheKey.for(spec.name, spec.version.to_s, platform)

Expand Down
2 changes: 1 addition & 1 deletion prebake.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "prebake"
spec.version = "0.3.4"
spec.version = "0.3.5"
spec.authors = ["Thejus Paul"]
spec.email = ["thejuspaul@pm.me"]

Expand Down
16 changes: 14 additions & 2 deletions test/async_publisher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def teardown
FileUtils.rm_rf(@tmpdir)
end

def mock_spec(name, version)
stub(name:, version: Gem::Version.new(version))
def mock_spec(name, version, build_args: [])
stub(name:, version: Gem::Version.new(version), build_args:)
end

def temp_gem_path(name = "fake")
Expand Down Expand Up @@ -101,6 +101,18 @@ def test_pushes_without_check_when_max_glibc_unset
Prebake::AsyncPublisher.wait_for_completion(timeout: 5)
end

def test_skips_push_when_gem_was_compiled_with_build_options
spec = mock_spec("pg", "1.5.4", build_args: ["--with-pg-config=/opt/pg/bin/pg_config"])
backend = stub(exists?: false)
backend.expects(:push).never

builder = stub(build: temp_gem_path, checksum: "sha")
Prebake::PlatformGemBuilder.stubs(:new).with(spec).returns(builder)

Prebake::AsyncPublisher.enqueue(spec, backend)
Prebake::AsyncPublisher.wait_for_completion(timeout: 5)
end

def test_skips_push_when_built_gem_needs_libruby_on_static_ruby
spec = mock_spec("bootsnap", "1.23.0")
gem_path = temp_gem_path
Expand Down
Loading