-
Notifications
You must be signed in to change notification settings - Fork 129
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
Rake tasks for running tests in Docker #120
Conversation
eb21174
to
fd4d447
Compare
Okay... sorry for all of the "commit vomit", but I think I am mostly at a good spot with this now. As mentioned in the second-to-last commit, this is mostly where I think I will leave the final solution, but wanted to leave the Regarding some of the tests failures, it seems like there is still a sporadic test failure that I have see happen multiple times now:
The last one in that list is from my other PR, #119 (which that failure prompted this PR), so it isn't related to any of my changes (I think). Probably can be fixed in a different PR, but possibly just raising the threshold to 20 will make it behave better on Travis... ¯\(°_o)/¯ Edit: Ugh... my last commit decided it didn't want to work on travis... I might just can that one tomorrow... |
c1f717f
to
fd4d447
Compare
fd4d447
to
eeed46b
Compare
If a user has a local `.ruby-version` file in the project directory for `stackprof`, this can cause some extra noise in the docker builds. Adding this file simply tells `docker` to ignore it when doing a `ADD`.
These are helper tasks for docker that are used to facilitate a similar testing environment that would be seen on Travis. This even allows for running tests against all tested versions of Ruby. Specifically, once all of the images have been built for each version, re-running tests against all versions of ruby takes only about 10sec on my machine: $ time rake test:docker ==> Building Docker Image for 2.1... docker build -t stackprof-2.1 --build-arg=RVM_RUBY_VERSION=2.1 . {[:out, :err]=>"/dev/null"} docker run --rm stackprof-2.1 mesg: ttyname failed: Inappropriate ioctl for device install -c tmp/x86_64-linux/stackprof/2.1.10/stackprof.so lib/stackprof/stackprof.so cp tmp/x86_64-linux/stackprof/2.1.10/stackprof.so tmp/x86_64-linux/stage/lib/stackprof/stackprof.so Run options: --seed 21454 # Running: ........................ Finished in 0.263683s, 91.0185 runs/s, 284.4327 assertions/s. 24 runs, 75 assertions, 0 failures, 0 errors, 0 skips ==> Building Docker Image for 2.2... docker build -t stackprof-2.2 --build-arg=RVM_RUBY_VERSION=2.2 . {[:out, :err]=>"/dev/null"} docker run --rm stackprof-2.2 mesg: ttyname failed: Inappropriate ioctl for device install -c tmp/x86_64-linux/stackprof/2.2.10/stackprof.so lib/stackprof/stackprof.so cp tmp/x86_64-linux/stackprof/2.2.10/stackprof.so tmp/x86_64-linux/stage/lib/stackprof/stackprof.so Run options: --seed 47520 # Running: ........................ Finished in 0.270496s, 88.7260 runs/s, 277.2687 assertions/s. When using `docker-machine`, simply create a `docker-machine` VM, sync up the environment to point to the VM running docker, and run the rake tasks normally: $ docker-machine create --driver virtualbox default $ eval $(docker-machine env default) $ rake test:docker:all $ rake test:docker:clean $ rake test:docker:2.4
Reduces the noise when running `rake test:docker:all`.
Will help keep the list of ruby versions found in the .travis.yml in sync with the ones in the Rakefile, since if a new version of ruby is added to the .travis.yml, but it will break the tasks. This makes `rake test:docker:all` have a better chance of accurately representing a full Travis build across all rubies.
hopefully this will load the .rvm scripts...
Travis docs seem to suggest we don't... https://docs.travis-ci.com/user/docker/
Yeah, we are now using the `Rakefile`, so we need to bundle so `rake/extensiontask` is available...
This is the other option I guess... though, probably better that we just use `bundle install` on CI, as it is only 3 seconds to do that.
I think this is the route I am going to go with, and will most likely rebase these [FIXUP] and [DEBUG] commits out. It makes use of the `bundle install` that is already done by travis anyway (since we did a `before_install` instead of overwriting the `install`, this was being done when I switched the language back to `ruby`), it makes for a simpler diff to digest. Also... I think the `bundle exec rake ...` might be required...
eeed46b
to
b639f54
Compare
In other words: "un-seattle.rb" the method declarations. Force of habit...
Travis will require a `bundle install` so `rake/extensiontask` is available when running the Rakefile, but we don't want to include this in the `docker` build, so exclude it via the `.dockerignore`
a377e0f
to
268839b
Compare
@tmm1 (or anyone for that matter): Is this something of interest that I should keep open or should I close. Had a few bugs from when I last left it with in CI that I had to resolve, and would of course rebase prior to a merge, but if this is adding complexity you would rather not have then I don't mind just closing. Thanks. |
Now not relevant with the recent changes to use GitHub Actions. Closing. |
This is a set of helper rake tasks are intended to make running tests locally in docker much streamline and simpler to pick up as a new-comer to the project.
Requires a
docker
environment available in your shell environment.Quick Start
To simply run the rake tasks, you can run:
$ rake test:docker
To specify a specific target ruby version:
$ rake test:docker:2.1
@mame Curious about your thoughts on this one since you recently did the work #116 to start running tests on travis with
docker
.