travisjeffery / timecop

A gem providing "time travel", "time freezing", and "time acceleration" capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
MIT License
3.36k stars 223 forks source link

Dealing with a corrupted cache #397

Closed mishina2228 closed 1 year ago

mishina2228 commented 1 year ago

This PR attempts to fix failing CI with Ruby 2.5. refs: #391

ruby/setup-ruby provides the function to cache bundle install, but sometimes this cache seems to corrupt. https://github.com/ruby/setup-ruby#dealing-with-a-corrupted-cache

In some rare scenarios (like using gems with C extensions whose functionality depends on libraries found on the system at the time of the gem's build) it may be necessary to ignore contents of the cache and get and build all the gems anew. In order to achieve this, set the cache-version option to any value other than 0 (or change it to a new unique value if you have already used it before.)

The most recent logs show that psych builds are failing, which is exactly the situation. https://github.com/travisjeffery/timecop/actions/runs/3578996103/jobs/6019716355

...
  Fetching psych 4.0.6
  Using pry 0.14.1
  Fetching faraday 1.10.2
  --- ERROR REPORT TEMPLATE -------------------------------------------------------

ArgumentError: wrong number of arguments (given 4, expected 1) /home/runner/work/timecop/timecop/vendor/bundle/ruby/2.5.0/gems/psych-4.0.4/lib/psych.rb:322:in safe_load' /opt/hostedtoolcache/Ruby/2.5.9/x64/lib/ruby/2.5.0/rubygems/safe_yaml.rb:31:insafe_load' /opt/hostedtoolcache/Ruby/2.5.9/x64/lib/ruby/2.5.0/rubygems/package.rb:496:in `block (2 levels) in read_checksums' ...

mishina2228 commented 1 year ago

@joshuacronemeyer Could you try to see if this works?

mishina2228 commented 1 year ago

Psych 5.0 has been released, but CI on Ruby 2.6+ now fails due to lack of libyaml-dev.

This issue has been discussed on the psych side, but since psych is a dependent gem of jeweler, the problem should go away if jeweler is removed in #392.

joshuacronemeyer commented 1 year ago

thanks @mishina2228