-
Notifications
You must be signed in to change notification settings - Fork 4
Add Rspec included modules support #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
9ffb93e
f4faace
66d55fd
7c817e7
49f22c1
1f8ac4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,10 @@ on: | |
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| SOLARGRAPH_CACHE: "${{ github.workspace }}/solargraph-rspec/gem-cache" | ||
| BUNDLE_GEMFILE: "${{ github.workspace }}/solargraph-rspec/gemfiles/default.gemfile" | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Tests (ruby v${{ matrix.ruby-version }}) | ||
|
|
@@ -25,7 +29,6 @@ jobs: | |
| # FIXME: Why '3.0' is not working with Appraisal? | ||
| # FIXME: Add 'head' https://github.com/lekemula/solargraph-rspec/pull/8/commits/3b52752b96e7f2ec01831406f8e5a51c91523187 | ||
| ruby-version: ['3.1', '3.2', '3.3'] | ||
|
|
||
| steps: | ||
| - name: Checkout solargraph-rspec | ||
| uses: actions/checkout@v4 | ||
|
|
@@ -42,32 +45,33 @@ jobs: | |
| - name: Cache Ruby gems | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: solargraph-rspec/vendor/bundle | ||
| key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('solargraph-rspec/solargraph-rspec.gemspec') }} | ||
| restore-keys: | | ||
| bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('solargraph-rspec/solargraph-rspec.gemspec') }} | ||
| path: solargraph-rspec/gemfiles/vendor/bundle | ||
| key: bundle-use-ruby-${{ matrix.ruby-version }}-${{ hashFiles('solargraph-rspec/Gemfile', 'solargraph-rspec/gemfiles/default.gemfile.lock') }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| cd solargraph-rspec | ||
| bundle config path vendor/bundle | ||
| bundle install --jobs 4 --retry 3 | ||
| bundle exec appraisal install | ||
|
|
||
| - name: Run Rubocop | ||
| run: cd solargraph-rspec && bundle exec rubocop | ||
| # - name: Run Rubocop | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't forget to bring this back again. |
||
| # run: cd solargraph-rspec && bundle exec rubocop | ||
|
|
||
| - name: Set up yardocs | ||
| # yard gems caches the yardocs into <gem_path>/doc/.yardoc path, hence they should be cached by ruby gems cache | ||
| run: cd solargraph-rspec && bundle exec appraisal yard gems --verbose | ||
| - name: 'Apply solargraph debug patch' | ||
|
lekemula marked this conversation as resolved.
Outdated
|
||
| run: |- | ||
| echo 'exclude: ["vendor/**/*", "gemfiles/**/*"]' > solargraph-rspec/.solargraph.yml | ||
| cd solargraph-rspec/gemfiles/vendor/bundle/ruby/${{ matrix.ruby-version }}.0/gems/solargraph-0.56.0 | ||
|
|
||
| - name: List all Yardoc constants and methods | ||
| run: | | ||
| cd solargraph-rspec | ||
| bundle exec yard list | ||
| awk '/Caching yardoc for/ { print "return nil unless Dir.exist?(gemspec.gem_dir)"; print; next }1' lib/solargraph/yardoc.rb > tmp.rb | ||
| mv tmp.rb lib/solargraph/yardoc.rb | ||
|
|
||
| - name: Cache Docs | ||
| run: |- | ||
| cd solargraph-rspec | ||
| bundle exec solargraph gems --rebuild | ||
|
|
||
| - name: Run tests | ||
| run: cd solargraph-rspec && bundle exec appraisal rspec --format progress | ||
| run: cd solargraph-rspec && bundle exec rspec --format progress | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep the Appraisal gem in place. While I understand that you're replicating its behavior under the hood, relying on the gem provides a clear standard and well-maintained documentation. This makes it easier for other contributors to understand how things work without needing to dig into custom logic. |
||
|
|
||
| - name: Upload coverage reports to Codecov | ||
| uses: codecov/codecov-action@v4 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,7 @@ | |
|
|
||
| # rspec failure tracking | ||
| .rspec_status | ||
|
|
||
| .solargraph.yml | ||
| vendor | ||
| gemfiles/vendor | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| --- | ||
| BUNDLE_RETRY: "1" | ||
| BUNDLE_PATH: "vendor/bundle" |
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. important: These changes are more appropriate for the Additionally, this approach helps avoid redundant requires and pins in individual spec files, which could unnecessarily increase Solargraph's memory usage.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True - the one concern I have (which btw, not done right now) is "how do we handle updates to this file"? Imo the simple and easy approach is to call reset if the file name matches one of the configured paths but idk how I'd propagate that to the rest of the files (even via global)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imo its not a HUGE issue since those files are edited rarely (let alone to include a module) but still, something to think about
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's a very good point that I overlooked. As you said, these files tend not to change often, and I also don't find that to be the end of the world. One in theory could fix that by restarting the LSP, albeit not an ideal solution. What we could do, though, is to include these pins in I think/hope this would ensure that whenever these files are changed, we would get the latest includes on the spec files. Can we try this? If it does not work, I'd still go with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, but I think we need to check
solargraph-rspec.gemspec, andsolargraph-rspec/Gemfile, andAppraisalsfile instead.The
solargraph-rspec/gemfiles/default.gemfile.lockis just a product of theAppraisalsfile, where in the future there could potentially be more dependency versions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not so sure - the gemlock file is the source of truth on pinned gems for tests, which could be updated without either of those 2 changing