Skip to content

Commit

Permalink
Add .gitlab-ci.yml for testing on GitLab CI
Browse files Browse the repository at this point in the history
Signed-off-by: Stan Hu <stanhu@gmail.com>
  • Loading branch information
stanhu committed Apr 9, 2021
1 parent 93d0ca0 commit 02c1fc9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.test-template: &test
cache:
paths:
- vendor/ruby
before_script:
- gem install bundler --no-document
- bundle config set --local path 'vendor/bundle'
- bundle config set --local without 'development'
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby

This comment has been minimized.

Copy link
@eregon

eregon Apr 10, 2021

The --path vendor seems extra here.

This comment has been minimized.

Copy link
@eregon

eregon Apr 11, 2021

And the path to cache above should be vendor/bundle and not vendor/ruby

- ruby -v # Print out ruby version for debugging
script:
- bundle exec rake compile
- bundle exec rake test

rspec-2.7:
image: "ruby:2.7"
<<: *test

rspec-3.0:
image: "ruby:3.0"
<<: *test

This comment has been minimized.

Copy link
@eregon

eregon Apr 10, 2021

Is there a way to test on other Rubies like truffleruby like https://github.com/kwilczynski/ruby-magic/blob/3d37fc449de08069dd32d46689d18bb633d2c2ba/.travis.yml does?

A more general question:
Is it possible to test on other operating systems (macOS/Windows) if desired? (so no Docker)

This comment has been minimized.

Copy link
@stanhu

stanhu Apr 10, 2021

Author Contributor

I attempted to enable truffleruby and got this failure: https://gitlab.com/gitlab-org/ruby-magic/-/jobs/1168731403

I am using https://hub.docker.com/r/flavorjones/truffleruby. Is there a better image to use?

This comment has been minimized.

Copy link
@eregon

eregon Apr 11, 2021

That seems to work fine.
The fork test should be skipped if !Process.respond_to?(:fork).

The other error is something we'll fix on TruffleRuby's side: oracle/truffleruby#2307
Probably best to skip that test on truffleruby until it's fixed to keep the CI green.
cc @kwilczynski

This comment has been minimized.

Copy link
@eregon

eregon Apr 11, 2021

It seems to work now, probably that was on an older version?
https://gitlab.com/stanhu/ruby-magic/-/pipelines/284439982

This comment has been minimized.

Copy link
@kwilczynski

kwilczynski Apr 11, 2021

Owner

Hi @eregon,

The TruffleRuby compatibility should have been resolved some time go, indeed. :) An up-to-date version of the code would have the changes.

Krzysztof

0 comments on commit 02c1fc9

Please sign in to comment.