diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index cd894d7..d0359be 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -23,20 +23,26 @@ jobs: solargraph-version: - "0.48.0" - "0.49.0" + rails-version: + - "7" fail-fast: false steps: - uses: actions/checkout@v2 - - name: Cache RVM + - uses: ruby/setup-ruby@v1 + with: + working-directory: spec/rails${{ matrix.rails-version }} + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Cache yardoc uses: actions/cache@v3 id: rvm with: - key: ${{ runner.os }}-rvm-${{ matrix.ruby-version }} + key: ${{ runner.os }}-yard-${{ matrix.ruby-version }}-${{ matrix.solargraph-version }} path: | - /home/runner/.rvm /home/runner/.yardoc - #/usr/local/rvm/ - #- name: Setup upterm session - # uses: lhotari/action-upterm@v1 - - name: Test - run: "/bin/bash ./ci.sh ${{ matrix.ruby-version }} ${{ matrix.solargraph-version}}" + + - name: RSpec + run: bundle exec rspec + diff --git a/ci.sh b/ci.sh deleted file mode 100755 index 75d0f6d..0000000 --- a/ci.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -set -e -# when running in github actions: -RVM_PATH=/home/runner/.rvm -# when running locally using act: -#RVM_PATH=/usr/local/rvm -MATRIX_RUBY_VERSION=$1 -MATRIX_SOLARGRAPH_VERSION=$2 - -if [[ ! -d $RVM_PATH ]]; then - # this fetches the develop version; using -s stable should fetch the latest stable, but has a gpg error: - curl -sSL https://get.rvm.io | bash -s -fi - -# when running in github actions: -source /home/runner/.rvm/scripts/rvm -# when running locally in Act container: -#source /usr/local/rvm/scripts/rvm - - -#rvm package install openssl # hack because ubuntu won't give us openSSL -rvm install ruby $MATRIX_RUBY_VERSION -rvm use $MATRIX_RUBY_VERSION -gem install bundler - -echo "s/gem 'solargraph'/gem 'solargraph', '${MATRIX_SOLARGRAPH_VERSION}'/" > command.sed - -(cd spec/rails5; sed -i -f ../../command.sed Gemfile; cat Gemfile; bundle install; yard gems) -(cd spec/rails6; sed -i -f ../../command.sed Gemfile; cat Gemfile; bundle install; yard gems) -(cd spec/rails7; sed -i -f ../../command.sed Gemfile; cat Gemfile; bundle install; yard gems) - -bundle install - -bundle exec rspec diff --git a/solargraph-rails.gemspec b/solargraph-rails.gemspec index a0ce42d..c34640c 100644 --- a/solargraph-rails.gemspec +++ b/solargraph-rails.gemspec @@ -2,6 +2,9 @@ lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'solargraph/rails/version' + +solargraph_version = (ENV['CI'] && ENV['MATRIX_SOLARGRAPH_VERSION']) || ">= 0.48.0" + Gem::Specification.new do |spec| spec.name = 'solargraph-rails' spec.version = Solargraph::Rails::VERSION @@ -27,6 +30,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rake', '~> 12.3.3' spec.add_development_dependency 'rspec', '~> 3.0' - spec.add_runtime_dependency 'solargraph' + spec.add_runtime_dependency 'solargraph', solargraph_version spec.add_runtime_dependency 'activesupport' end diff --git a/spec/rails7/Gemfile b/spec/rails7/Gemfile index e8c70ec..5c31163 100644 --- a/spec/rails7/Gemfile +++ b/spec/rails7/Gemfile @@ -10,3 +10,8 @@ group :development do gem 'solargraph', require: false gem 'solargraph-rails', require: false, path: '../..' end + +group :test do + # not strictly needed but simplifies the CI setup. + gem 'rspec' +end