diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 111cfdff..cb03a339 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,9 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: + ruby: + - 2.7.6 + - 3.0.4 os: - ubuntu-latest - macos-latest @@ -21,7 +24,8 @@ jobs: steps: - uses: actions/checkout@v3 - if: matrix.os == 'windows-latest' - run: echo "startup --output_user_root=D:/_bazel" >> .bazelrc + run: echo "startup --output_user_root=D:/" >> .bazelrc + - run: echo 'RUBY_VERSION = "${{ matrix.ruby }}"' > ruby_version.bzl - run: bazel build ... - run: bazel run lib/gem:print-version - run: bazel run :rubocop diff --git a/examples/gem/WORKSPACE b/examples/gem/WORKSPACE index 448a2f37..3df32200 100644 --- a/examples/gem/WORKSPACE +++ b/examples/gem/WORKSPACE @@ -4,10 +4,9 @@ local_repository( ) load("@rules_ruby//ruby:deps.bzl", "rb_bundle", "rb_download") +load("ruby_version.bzl", "RUBY_VERSION") -rb_download( - version = "2.7.5" -) +rb_download(version = RUBY_VERSION) rb_bundle( name = "bundle", diff --git a/examples/gem/lib/gem/version.rb b/examples/gem/lib/gem/version.rb index 920e5e7c..54fbf207 100644 --- a/examples/gem/lib/gem/version.rb +++ b/examples/gem/lib/gem/version.rb @@ -4,4 +4,7 @@ module GEM VERSION = '0.1.0' end -puts "Version is: #{GEM::VERSION}" if __FILE__ == $PROGRAM_NAME +if __FILE__ == $PROGRAM_NAME + puts "Ruby is: #{RUBY_ENGINE}/#{RUBY_VERSION}" + puts "Version is: #{GEM::VERSION}" +end diff --git a/examples/gem/ruby_version.bzl b/examples/gem/ruby_version.bzl new file mode 100644 index 00000000..b13f3f26 --- /dev/null +++ b/examples/gem/ruby_version.bzl @@ -0,0 +1 @@ +RUBY_VERSION = "2.7.6" diff --git a/ruby/private/bundle.bzl b/ruby/private/bundle.bzl index 9ced10a6..49e5c4b8 100644 --- a/ruby/private/bundle.bzl +++ b/ruby/private/bundle.bzl @@ -26,7 +26,7 @@ def _rb_bundle_impl(repository_ctx): [bundle, "install"], environment = { "BUNDLE_BIN": repr(binstubs_path), - "BUNDLE_GEMFILE": repr(gemfile), + "BUNDLE_GEMFILE": gemfile.basename, "BUNDLE_SHEBANG": repr(ruby), }, working_directory = repr(gemfile.dirname), diff --git a/test.cmd b/test.cmd index ef61d513..5008a420 100644 --- a/test.cmd +++ b/test.cmd @@ -1,14 +1,6 @@ cd examples/gem -:: rb_library -bazel build :gem || exit /b - -:: rb_binary +bazel build ... || exit /b bazel run lib/gem:print-version || exit /b bazel run :rubocop || exit /b - -:: rb_test -bazel test spec:all || exit /b - -:: rb_gem_build -bazel build :gem-build || exit /b +bazel test spec/... || exit /b diff --git a/test.sh b/test.sh index b91c10e2..21b84828 100755 --- a/test.sh +++ b/test.sh @@ -2,15 +2,7 @@ cd examples/gem || exit 1 -# rb_library -bazel build :gem || exit 1 - -# rb_binary +bazel build ... || exit 1 bazel run lib/gem:print-version || exit 1 bazel run :rubocop || exit 1 - -# rb_test -bazel test spec:all || exit 1 - -# rb_gem_build -bazel build :gem-build || exit 1 +bazel test spec/... || exit 1