Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try migrating from Travis to Github Actions #647

Merged
merged 28 commits into from Jun 15, 2021
Merged

Try migrating from Travis to Github Actions #647

merged 28 commits into from Jun 15, 2021

Conversation

jywarren
Copy link
Member

@jywarren jywarren commented Jun 10, 2021

@gitpod-io
Copy link

gitpod-io bot commented Jun 10, 2021

@jywarren jywarren changed the title Create tests.yml Try migrating from Travis to Github Actions Jun 10, 2021
.github/workflows/tests.yml Outdated Show resolved Hide resolved
@jywarren
Copy link
Member Author

bundle install
  /opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle config --local path /home/runner/work/spectral-workbench/spectral-workbench/vendor/bundle
  You are replacing the current local value of path, which is currently nil
  /opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle config --local deployment true
  You are replacing the current local value of deployment, which is currently nil
  Cache key: setup-ruby-bundler-cache-v3-ubuntu-20.04-ruby-2.6.6-Gemfile.lock-ad03bd78440830dff9a020c0763f27f3916f8bae156b48a66d063789a30318ff
  /opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle install --jobs 4
  Unable to find a spec satisfying mimemagic (~> 0.3.0) in the set. Perhaps the
  lockfile is corrupted?
  Took   0.93 seconds
Error: The process '/opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle' failed with exit code 7

Maybe we need to update mimemagic to get this to work?

@jywarren
Copy link
Member Author

Aha - yes. we need to upgrade to mimemagic v0.3.6 - https://www.reddit.com/r/ruby/comments/mc5bpe/mimemagic_versions_prior_to_036_have_been_yanked/

@jywarren
Copy link
Member Author

rails/rails#41757

@jywarren
Copy link
Member Author

Closer, but now this error:

** Execute environment
rake aborted!
Errno::ENOENT: No such file or directory - bs_fetch:open_current_file:open
/home/runner/work/spectral-workbench/spectral-workbench/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.7/lib/bootsnap/compile_cache/yaml.rb:51:in `fetch'
/home/runner/work/spectral-workbench/spectral-workbench/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.7/lib/bootsnap/compile_cache/yaml.rb:51:in `block in install!'

@jywarren
Copy link
Member Author

We're stuck at the bootsnap cache read. Bootsnap was introduced here: ec7afdf#diff-441bbd2acf3b2eab84a98d917f574109eafd6c54cbce74a2379487f9f67920a2R4

@jywarren
Copy link
Member Author

Shopify/bootsnap#177

@jywarren
Copy link
Member Author

Aha - in parallel builds, there's a race condition: Shopify/bootsnap#177 (comment)

bootsnap cache failing when multiple parallel builds try to access it at the same time
@jywarren
Copy link
Member Author

@jywarren
Copy link
Member Author

We should try to remove yarn from each job since i just moved it to the setup action, which gets reused.

@jywarren
Copy link
Member Author

Hmm, i can't seem to get the Yarn install step running in the re-used segment. But it seems required there:

Error: /home/runner/work/spectral-workbench/spectral-workbench/./.github/actions/setup-test-environment/action.yml (Line: 16, Col: 5): Required property is missing: shell

https://github.com/publiclab/spectral-workbench/pull/647/checks?check_run_id=2805667925#step:4:1

@waridrox would you like to try making some progress on this? GitHub Actions is pretty obscure but we do seem close to getting it running. It'd be amazing to have tests up again!

@@ -3,4 +3,4 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
# require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here i just turned off Bootsnap for now. Let's get it running in GitHub Actions and then we can re-enable it in follow-up once we figure it out. The issue seems to be accessing the tmp directory from parallel builds at the same time (for caching in bootsnap), which locks things up.

cp config/config.yml.example config/config.yml
sudo systemctl start mysql
mysql -uroot -proot -e "CREATE DATABASE swbench;"
bundle exec rake db:schema:load db:migrate --trace
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, i'm seeing: Mysql2::Error::ConnectionError: Access denied for user 'runner'@'localhost' (using password: NO)

cp config/config.yml.example config/config.yml
sudo systemctl start mysql
mysql -uroot -proot -e "CREATE DATABASE swbench_test;"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'swbench_test'@'%';";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this because i got:

Mysql2::Error::ConnectionError: Access denied for user 'runner'@'localhost' (using password: NO)

but after this i got:

ERROR 1410 (42000) at line 1: You are not allowed to create a user with GRANT

@jywarren
Copy link
Member Author

jywarren commented Jun 15, 2021

OK! We're up and running and passed our models and helpers tests! Now digging in deeper on remaining tests.

I see these errors; we've seen ones like these before at plots2:

SetsControllerTest#test_should_show_spectra_set_new_embed:
ActionView::Template::Error: Mysql2::Error: Expression #8 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'swbench_test.snapshots.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by: SELECT DISTINCT(spectrums.id), spectrums.title, spectrums.created_at, spectrums.id, spectrums.calibrated, spectrums.user_id, like_count, snapshots.id AS snapshot_id FROM `spectrums` INNER JOIN `spectra_sets_spectrums` ON `spectra_sets_spectrums`.`spectrum_id` = `spectrums`.`id` INNER JOIN `spectra_sets` ON `spectra_sets`.`id` = `spectra_sets_spectrums`.`spectra_set_id` LEFT OUTER JOIN snapshots ON snapshots.spectrum_id = spectrums.id WHERE (spectra_sets.id = 980190962) GROUP BY spectrums.id
    app/views/graph/_spectra.html.erb:12:in `_app_views_graph__spectra_html_erb___4124730961824684010_47234358832680'
    app/views/embed/set.html.erb:21:in `_app_views_embed_set_html_erb__1867968919589246167_47234350308240'
    app/controllers/sets_controller.rb:68:in `embed2'
    test/controllers/sets_controller_test.rb:53:in `block in <class:SetsControllerTest>'

bin/rails test test/controllers/sets_controller_test.rb:52

<th><%= spectrums.length if spectrums %> Spectra</th>

Here's the query:

@spectrums = Spectrum.select('DISTINCT(spectrums.id), spectrums.title, spectrums.created_at, spectrums.id, spectrums.calibrated, spectrums.user_id, like_count, snapshots.id AS snapshot_id')
.joins('LEFT OUTER JOIN snapshots ON snapshots.spectrum_id = spectrums.id')
.joins(:spectra_sets)
.where('spectra_sets.id = ?', @set.id)
.group('spectrums.id')

@jywarren
Copy link
Member Author

That error was for controllers and integration tests, while system tests failed for this:


HomeTest#test_Capture_Spectra_should_redirect:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
    test/system/home_test.rb:14:in `block in <class:HomeTest>'

Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
    test/system/home_test.rb:5:in `block in <class:HomeTest>'

@jywarren
Copy link
Member Author

Yay!

image

@jywarren
Copy link
Member Author

Hooray!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant