Skip to content

Run specs in parallel, speed up CI, fix concurrency bugs in specs and code #3173

Run specs in parallel, speed up CI, fix concurrency bugs in specs and code

Run specs in parallel, speed up CI, fix concurrency bugs in specs and code #3173

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with rspec.
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
name: RSpec
on:
push:
branches: [ master ]
pull_request:
branches: ['*']
permissions:
contents: read
jobs:
rspec:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0', 'head']
rbs-version: ['3.6.1', '3.8.1', '3.9.5', '3.10.0', '4.0.0.dev.5']
# Ruby 3.0 doesn't work with RBS 3.9.4 or 4.0.0.dev.4
exclude:
# only include the 3.0 variants we include later
- ruby-version: '3.0'
# only include the 3.1 variants we include later
- ruby-version: '3.1'
# only include the 3.2 variants we include later
- ruby-version: '3.2'
# only include the 3.3 variants we include later
- ruby-version: '3.3'
# only include the 3.4 variants we include later
- ruby-version: '3.4'
# only include the 4.0 variants we include later
- ruby-version: '4.0'
# Don't exclude 'head' - let's test all RBS versions we
# can there.
#
#
# Just exclude some odd-ball compatibility issues we can't
# work around:
#
# https://github.com/castwide/solargraph/actions/runs/20627923548/job/59241444380?pr=1102
- ruby-version: 'head'
rbs-version: '3.6.1'
- ruby-version: 'head'
rbs-version: '3.8.1'
include:
- ruby-version: '3.0'
rbs-version: '3.6.1'
- ruby-version: '3.1'
rbs-version: '3.6.1'
- ruby-version: '3.2'
rbs-version: '3.8.1'
- ruby-version: '3.3'
rbs-version: '3.9.5'
- ruby-version: '3.3'
rbs-version: '3.10.0'
- ruby-version: '3.4'
rbs-version: '4.0.0.dev.5'
- ruby-version: '4.0'
rbs-version: '4.0.0.dev.5'
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Set rbs version
run: echo "gem 'rbs', '${{ matrix.rbs-version }}'" >> .Gemfile
# /home/runner/.rubies/ruby-head/lib/ruby/gems/3.5.0+2/gems/rbs-3.9.4/lib/rbs.rb:11:
# warning: tsort was loaded from the standard library,
# but will no longer be part of the default gems
# starting from Ruby 3.6.0
- name: Work around legacy rbs deprecation on ruby > 3.4
run: echo "gem 'tsort'" >> .Gemfile
- name: Update gems
run: |
bundle update rbs # use latest available for this Ruby version
- name: Update types
run: |
bundle exec rbs collection update
# avoid trying to do this in parallel during the specs
bundle exec solargraph gems core stdlib
- name: Run tests
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 path $PWD/vendor/bundle
WORKERS=$(nproc --all)
export WORKERS
echo "Running tests with WORKERS=$WORKERS"
bundle exec rake full_spec
undercover:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# fetch all history for all branches and tags so we can
# compare against origin/master
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- name: Update gems
run: |
bundle update rbs # use latest available for this Ruby version
- name: Update types
run: |
bundle exec rbs collection update
# avoid trying to do this in parallel during the specs
bundle exec solargraph gems core stdlib
- name: Run tests
run: |
WORKERS=$(nproc --all)
export WORKERS
echo "Running tests with WORKERS=$WORKERS"
bundle exec rake full_spec
- name: Check PR coverage
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 path $PWD/vendor/bundle
WORKERS=$(nproc --all)
export WORKERS
# avoid trying to do this in parallel during the specs
bundle exec solargraph gems core stdlib
bundle exec rake undercover
continue-on-error: true