Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
permissions:
contents: read

env:
SOLARGRAPH_CACHE: ${{ github.workspace }}/vendor/solargraph/cache
BUNDLE_PATH: ${{ github.workspace }}/vendor/bundle

jobs:
test:
name: Tests (ruby v${{ matrix.ruby-version }})
Expand All @@ -39,16 +43,16 @@ jobs:
- name: Cache Ruby gems
uses: actions/cache@v3
with:
path: vendor/bundle
path: ${{ env.BUNDLE_PATH }}
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('solargraph-rspec.gemspec') }}
restore-keys: |
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('solargraph-rspec.gemspec') }}

- name: Install dependencies
run: |
bundle config path vendor/bundle
bundle config path ${{ env.BUNDLE_PATH }}
bundle install --jobs 4 --retry 3 # we need this to install appraisal
bundle exec appraisal bundle config path ../vendor/bundle
bundle exec appraisal bundle config path ${{ env.BUNDLE_PATH }}
bundle exec appraisal install --jobs 4 --retry 3
# 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
Expand All @@ -59,13 +63,19 @@ jobs:
# https://github.com/rubocop/rubocop/issues/10893#issuecomment-1952517060
run: bundle exec rubocop --restart-server

- name: Cache Solargraph YARD and RBS pins for gems
uses: actions/cache@v4
with:
path: ${{ env.SOLARGRAPH_CACHE }}
key: os-${{ runner.os }}-ruby-${{ matrix.ruby-version }}-solargraph-${{ hashFiles('**/Gemfile.lock') }}

- name: Configure .solargraph.yml
run: cp .solargraph.yml.example .solargraph.yml

- name: Solargraph cache RSpec plugins YARD and RBS
- name: Solargraph generate RSpec plugins YARD and RBS pins
run: |
rspec_plugins=$(bundle exec appraisal bundle exec ruby -r './lib/solargraph-rspec' -e 'puts Solargraph::Rspec::TestHelpers.gem_names.join(" ")' 2>/dev/null | tail -n1)
bundle exec appraisal bundle exec solargraph gems --rebuild $rspec_plugins
bundle exec appraisal bundle exec solargraph gems $rspec_plugins

- name: Run tests
run: bundle exec appraisal rspec --format progress
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
permissions:
contents: read

env:
SOLARGRAPH_CACHE: ${{ github.workspace }}/vendor/solargraph/cache
RUBY_VERSION: 3.4

jobs:
solargraph_typed:
name: Solargraph / typed
Expand All @@ -27,11 +31,15 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
bundler-cache: false
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true # runs bundle install and caches the gems
- name: Cache Solargraph YARD and RBS pins for gems
uses: actions/cache@v4
with:
path: ${{ env.SOLARGRAPH_CACHE }}
key: os-${{ runner.os }}-ruby-${{ env.RUBY_VERSION }}-solargraph-${{ hashFiles('**/Gemfile.lock') }}
- name: Install gems
run: |
bundle install
bundle update rbs # use latest available for this Ruby version
- name: Install gem types
run: bundle exec rbs collection install
Expand Down
Loading