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

Problems getting parallel_tests to work in GitHub Action workflows #841

Open
bob-ashforth-sp opened this issue Feb 18, 2022 · 11 comments
Open

Comments

@bob-ashforth-sp
Copy link

We're having problems getting parallel_tests to work in GitHub Action workflows. Is this a known issue, or does anyone have any examples of correct commands to use in the workflow?

@grosser
Copy link
Owner

grosser commented Feb 18, 2022

Did not head that before.
Best follow https://github.com/grosser/parallel_tests/wiki/Distributed-Parallel-Tests-on-CI-systems or post what exactly you are seeing.

@bob-ashforth-sp
Copy link
Author

bob-ashforth-sp commented Mar 3, 2022 via email

@grosser
Copy link
Owner

grosser commented Mar 4, 2022

for singlecov: you'll have to combine singlecov results manually afaik, there might be something in simplecov docs ... alternatively make it generate multiple reports and the combine them something like https://github.com/grosser/cc-amend
or google around https://jes.al/2020/11/merging-simplecov-results-with-parallel-rails-specs

... for the other questions: that's just way too much text, sorry but I don't have enough time to dig into all this, please ask small precise questions or try googling around for support

@Amnesthesia
Copy link

@grosser One issue we've run into here is that whilst we get the specs to run, each subprocess now lacks environment variables that the parent had and a bunch of specs are now failing

@grosser
Copy link
Owner

grosser commented May 24, 2022

there is nothing in parallel_tests that removes env vars though ... maybe the issue is that 1 test used to set an env var and then the other used it ?
to verify: does the failing test also fail when run on it's own ?

@Amnesthesia
Copy link

@grosser Turns out this happened when I was trying to pass -n 4 to it to force 4 processes. We run Github Actions runners in Kubernetes, and each pod is allocated 4000 millicpu, which would be 4 cores. I'm pretty new to this and not entirely sure of how to deal with this, so I tried to restrict it to using 4 processes to correspond to the 4000 millicpu, but inside the container it still thinks it has 12 CPU, which means it probably has the same amount of cores but restricted usage of those cores

Not entirely sure how to deal with this — perhaps we still need to make it run with 12 cores even if it's restricted to using the equivalent of a third of that.

To pass that flag (without passing any other options) I had passed parallel:spec[,,,-n4] because when I tried to pass it any other way it would throw with "Cannot convert Integer to String". This happened because line 271 in lib/parallel_tests/tasks.rb:

abort unless system(*command) # allow to chain tasks e.g. rake parallel:spec parallel:features

Here, command became [..., '-n', 4] and it failed when that 4 was parsed as an Integer rather than a string. But passing it through as parallel:spec[,,,-n4] seems to have somehow made my environment variables nil

@grosser
Copy link
Owner

grosser commented May 24, 2022

parallel:spec[4]

should work on latest version

@grosser
Copy link
Owner

grosser commented May 24, 2022

run a single test in paralell_tests locally and verify that there is an env issue
afaik it works just fine:

>> ENV['X'] = '1'
=> "1"
>> system 'ruby', '-e', 'puts ENV["X"]'
1
=> true

@Amnesthesia
Copy link

Amnesthesia commented May 24, 2022

$ bundle exec rake parallel:spec[4]
rake aborted!
TypeError: no implicit conversion of Integer into String
/Users/amnesthesia/.rvm/gems/ruby-2.7.4/gems/parallel_tests-3.10.0/lib/parallel_tests/tasks.rb:261:in `system'
/Users/amnesthesia/.rvm/gems/ruby-2.7.4/gems/parallel_tests-3.10.0/lib/parallel_tests/tasks.rb:261:in `block (3 levels) in <main>'
/Users/amnesthesia/.rvm/gems/ruby-2.7.4/gems/sentry-ruby-core-5.3.1/lib/sentry/rake.rb:24:in `execute'
/Users/amnesthesia/.rvm/gems/ruby-2.7.4/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/Users/amnesthesia/.rvm/gems/ruby-2.7.4/bin/ruby_executable_hooks:22:in `eval'
/Users/amnesthesia/.rvm/gems/ruby-2.7.4/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => parallel:spec

I solved it by setting PARALLEL_TEST_PROCESSORS=4

@grosser
Copy link
Owner

grosser commented May 24, 2022

parallel_tests-3.10.0 -> bundle update parallel_tests

@krtschmr
Copy link

@rashforth https://github.blog/changelog/2022-09-01-github-actions-larger-runners-are-now-in-public-beta/
contact support to skip beta waitlist que. we run 8 and 16 core via GH Actions

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

No branches or pull requests

4 participants