Skip to content

Parallel rspec

Parallel rspec #1265

Workflow file for this run

---
name: Plugin
# To debug locally:
# npm install -g act
# cd /Users/broz/src/solargraph/ && act pull_request -j run_solargraph_rails_specs # e.g.
on:
push:
branches: [master]
pull_request:
branches: ['*']
permissions:
contents: read
jobs:
rails_and_rspec_typechecking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4 # keep same as typecheck.yml
bundler-cache: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: yq
version: 1.0
- name: Install gems
run: |
echo 'gem "solargraph-rails"' > .Gemfile
echo 'gem "solargraph-rspec"' >> .Gemfile
bundle install
bundle update --pre rbs
- name: Configure to use plugins
run: |
bundle exec solargraph config
yq -yi '.plugins += ["solargraph-rails"]' .solargraph.yml
yq -yi '.plugins += ["solargraph-rspec"]' .solargraph.yml
- name: Install gem types
run: bundle exec rbs collection update
- name: Ensure typechecking still works
run: bundle exec solargraph typecheck --level strong
rails_and_rspec_specs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
bundler-cache: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: yq
version: 1.0
- name: Install gems
run: |
echo 'gem "solargraph-rails"' > .Gemfile
echo 'gem "solargraph-rspec"' >> .Gemfile
bundle install
bundle update --pre rbs
- name: Configure to use plugins
run: |
bundle exec solargraph config
yq -yi '.plugins += ["solargraph-rails"]' .solargraph.yml
yq -yi '.plugins += ["solargraph-rspec"]' .solargraph.yml
- name: Install gem types
run: |
bundle exec rbs collection update
# avoid trying to do this in parallel during the specs
time bundle exec solargraph gems core stdlib default
- name: Ensure specs still run
run: |
# Speed up some of the bundle installs we run inside the tests
# as well when we're testing different solargraph usage
# scenarios. This is already set in the local bundle config by
# the setup-ruby action.
#
# See
# https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically
bundle config set path $PWD/vendor/bundle
SIMPLECOV_DISABLED=true
export SIMPLECOV_DISABLED
bundle exec rake full_spec
rails_typechecking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4 # keep same as typecheck.yml
# See https://github.com/castwide/solargraph/actions/runs/19000135777/job/54265647107?pr=1119
rubygems: latest
bundler-cache: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: yq
version: 1.0
- name: Install gems
run: |
echo 'gem "solargraph-rails"' > .Gemfile
bundle install
bundle update --pre rbs
- name: Configure to use plugins
run: |
bundle exec solargraph config
yq -yi '.plugins += ["solargraph-rails"]' .solargraph.yml
- name: Install gem types
run: bundle exec rbs collection update
- name: Ensure typechecking still works
run: bundle exec solargraph typecheck --level strong
rails_specs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
rubygems: latest
bundler-cache: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: yq
version: 1.0
- name: Install gems
run: |
echo 'gem "solargraph-rails"' > .Gemfile
bundle install
bundle update --pre rbs
- name: Configure to use plugins
run: |
bundle exec solargraph config
yq -yi '.plugins += ["solargraph-rails"]' .solargraph.yml
- name: Install gem types
run: |
bundle exec rbs collection update
# avoid trying to do this in parallel during the specs
bundle exec solargraph gems core stdlib
- name: Ensure specs still run
run: |
# Speed up some of the bundle installs we run inside the tests
# as well when we're testing different solargraph usage
# scenarios. This is already set in the local bundle config by
# the setup-ruby action.
#
# See
# https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically
bundle config set path $PWD/vendor/bundle
SIMPLECOV_DISABLED=true
export SIMPLECOV_DISABLED
bundle exec rake full_spec
rspec_typechecking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4 # keep same as typecheck.yml
bundler-cache: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: yq
version: 1.0
- name: Install gems
run: |
echo 'gem "solargraph-rspec"' >> .Gemfile
bundle install
bundle update --pre rbs
- name: Configure to use plugins
run: |
bundle exec solargraph config
yq -yi '.plugins += ["solargraph-rspec"]' .solargraph.yml
- name: Install gem types
run: bundle exec rbs collection update
- name: Ensure typechecking still works
run: bundle exec solargraph typecheck --level strong
rspec_specs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4 # keep same as typecheck.yml
bundler-cache: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: yq
version: 1.0
- name: Install gems
run: |
echo 'gem "solargraph-rspec"' >> .Gemfile
bundle install
bundle update --pre rbs
- name: Configure to use plugins
run: |
bundle exec solargraph config
yq -yi '.plugins += ["solargraph-rspec"]' .solargraph.yml
- name: Install gem types
run: |
set -x
bundle exec rbs collection update
rspec_gems=$(bundle exec ruby -r 'solargraph-rspec' -e 'puts Solargraph::Rspec::Gems.gem_names.join(" ")' 2>/dev/null | tail -n1)
# avoid trying to do this in parallel during the specs
bundle exec solargraph gems core stdlib $rspec_gems diff-lcs addressable ast rexml crack hashdiff rspec-support bigdecimal public_suffix
- name: Ensure specs still run
run: |
# Speed up some of the bundle installs we run inside the tests
# as well when we're testing different solargraph usage
# scenarios. This is already set in the local bundle config by
# the setup-ruby action.
#
# See
# https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically
bundle config set path $PWD/vendor/bundle
SIMPLECOV_DISABLED=true
export SIMPLECOV_DISABLED
bundle exec rake full_spec
run_solargraph_rspec_specs:
# check out solargraph-rspec as well as this project, and point the former to use the latter as a local gem
runs-on: ubuntu-latest
env:
SOLARGRAPH_CACHE: ${{ github.workspace }}/../solargraph-rspec/vendor/solargraph/cache
BUNDLE_PATH: ${{ github.workspace }}/../solargraph-rspec/vendor/bundle
steps:
- uses: actions/checkout@v3
- name: clone https://github.com/lekemula/solargraph-rspec/
run: |
cd ..
# git clone https://github.com/lekemula/solargraph-rspec.git
# pending https://github.com/lekemula/solargraph-rspec/pull/31
git clone https://github.com/apiology/solargraph-rspec.git
cd solargraph-rspec
git checkout test_solargraph_prereleases
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
rubygems: latest
bundler-cache: true
- name: Install gems
run: |
set -x
cd ../solargraph-rspec
echo "gem 'solargraph', path: '../solargraph'" >> Gemfile
bundle config set path ${{ env.BUNDLE_PATH }}
bundle install --jobs 4 --retry 3
bundle exec appraisal install
# @todo some kind of appraisal/bundle conflict?
# https://github.com/castwide/solargraph/actions/runs/19038710934/job/54369767122?pr=1116
# /home/runner/work/solargraph/solargraph-rspec/vendor/bundle/ruby/3.1.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:317:in
# `check_for_activated_spec!': You have already activated date
# 3.5.0, but your Gemfile requires date 3.4.1. Prepending
# `bundle exec` to your command may solve
# this. (Gem::LoadError)
bundle exec appraisal update date
# For some reason on ruby 3.1 it defaults to an old version: 1.3.2
# https://github.com/lekemula/solargraph-rspec/actions/runs/17814581205/job/50645370316?pr=22
# We update manually to the latest
bundle exec appraisal update rspec-rails
- name: Configure .solargraph.yml
run: |
cd ../solargraph-rspec
cp .solargraph.yml.example .solargraph.yml
- name: Solargraph generate RSpec gems YARD pins
run: |
cd ../solargraph-rspec
# solargraph-rspec's specs don't pass a workspace, so it
# doesn't know where to look for the RBS collection - let's
# not load one so that the solargraph gems command below works
rspec_gems=$(bundle exec appraisal ruby -r './lib/solargraph-rspec' -e 'puts Solargraph::Rspec::Gems.gem_names.join(" ")' 2>/dev/null | tail -n1)
bundle exec appraisal solargraph gems $rspec_gems
- name: Run specs
run: |
# Speed up some of the bundle installs we run inside the tests
# as well when we're testing different solargraph usage
# scenarios. This is already set in the local bundle config by
# the setup-ruby action.
#
# See
# https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically
bundle config set path $PWD/vendor/bundle
cd ../solargraph-rspec
SIMPLECOV_DISABLED=true
export SIMPLECOV_DISABLED
# avoid trying to do this in parallel during the specs
bundle exec solargraph gems core stdlib
bundle exec appraisal rspec --format progress
run_solargraph_rails_specs:
# check out solargraph-rails as well as this project, and point the former to use the latter as a local gem
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clone solargraph-rails
run: |
cd ..
git clone https://github.com/iftheshoefritz/solargraph-rails.git
cd solargraph-rails
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
# solargraph-rails supports Ruby 3.0+
ruby-version: '3.0'
bundler-cache: true
# https://github.com/apiology/solargraph/actions/runs/19400815835/job/55508092473?pr=17
rubygems: latest
bundler: latest
env:
MATRIX_RAILS_VERSION: "7.0"
- name: Install gems
run: |
set -x
# Share caches to speed up bundle install
#
# See
# https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically
cd ../solargraph-rails
echo "gem 'solargraph', path: '${GITHUB_WORKSPACE:?}'" >> Gemfile
bundle install
bundle update --pre rbs
env:
MATRIX_RAILS_VERSION: "7.0"
MATRIX_RAILS_MAJOR_VERSION: '7'
- name: Install gem types
run: |
cd ../solargraph-rails
RAILS_DIR="$(pwd)/spec/rails7"
export RAILS_DIR
cd ${RAILS_DIR}
bundle install
bundle exec --gemfile ../../Gemfile rbs --version
bundle exec --gemfile ../../Gemfile rbs collection install
cd ../../
# bundle exec rbs collection init
# bundle exec rbs collection install
env:
MATRIX_RAILS_VERSION: "7.0"
MATRIX_RAILS_MAJOR_VERSION: '7'
- name: Run specs
run: |
# Share caches to speed up bundle install
#
# See
# https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically
bundle config set path $PWD/vendor/bundle
cd ../solargraph-rails
bundle exec solargraph --version
bundle info solargraph
bundle info rbs
bundle info yard
SIMPLECOV_DISABLED=true
export SIMPLECOV_DISABLED
ALLOW_IMPROVEMENTS=true bundle exec rake spec
env:
MATRIX_RAILS_VERSION: "7.0"