-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[rust gem] Major improvements for gem scaffolding (rebased) #8455
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
Open
gjtorikian
wants to merge
14
commits into
ruby:master
Choose a base branch
from
gjtorikian:cargo-test-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+155
−34
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
38be055
[rust gem] Make cargo test work by default
ianks 958f84d
Include debug symbols by default in release builds for rust gems
ianks 54939ed
Default to using rb_sys for Cargo gem builds
ianks f2111de
Improve testing config
ianks d97b7a1
Support rake-compiler-dock precompiled require pattern by default
ianks 866a856
Lint
ianks e777e1e
Lint
ianks fe8d611
Support precompiled rust gems out of the box
ianks 7ad416d
Remove rubygems version constraint in cli
ianks f87f370
Remove hard coded constant
ianks e7d262f
Update magnus in Rust extension gem template
gjtorikian 637e6dc
update template dependencies
gjtorikian a606c3c
remove outdated rubies
gjtorikian d48434c
restore comment
gjtorikian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pub fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
| let _ = rb_sys_env::activate()?; | ||
|
|
||
| Ok(()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
bundler/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| name: Build gems | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
| - "cross-gem/*" | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| ci-data: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| result: ${{ steps.fetch.outputs.result }} | ||
| steps: | ||
| - uses: oxidize-rb/actions/fetch-ci-data@v1 | ||
| id: fetch | ||
| with: | ||
| supported-ruby-platforms: | | ||
| exclude: ["arm-linux", "x64-mingw32"] | ||
| stable-ruby-versions: | | ||
| exclude: ["head"] | ||
|
|
||
| source-gem: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| bundler-cache: true | ||
|
|
||
| - name: Build gem | ||
| run: bundle exec rake build | ||
|
|
||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: source-gem | ||
| path: pkg/*.gem | ||
|
|
||
| cross-gem: | ||
| name: Compile native gem for ${{ matrix.platform }} | ||
| runs-on: ubuntu-latest | ||
| needs: ci-data | ||
| strategy: | ||
| matrix: | ||
| platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| bundler-cache: true | ||
|
|
||
| - uses: oxidize-rb/actions/cross-gem@v1 | ||
| id: cross-gem | ||
| with: | ||
| platform: ${{ matrix.platform }} | ||
| ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }} | ||
|
|
||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: cross-gem | ||
| path: ${{ steps.cross-gem.outputs.gem-path }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,15 @@ RSpec.describe <%= config[:constant_name] %> do | |||||||||
| expect(<%= config[:constant_name] %>::VERSION).not_to be nil | ||||||||||
| end | ||||||||||
|
|
||||||||||
| <%- if config[:ext] == 'rust' -%> | ||||||||||
| it "can call into Rust" do | ||||||||||
| result = <%= config[:constant_name] %>.hello("world") | ||||||||||
|
|
||||||||||
| expect(result).to be("Hello earth, from Rust!") | ||||||||||
|
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. This needs Failure/Error: expect(result).to be("Hello earth, from Rust!")
expected #<String:1640> => "Hello earth, from Rust!"
got #<String:1648> => "Hello earth, from Rust!"
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
Suggested change
Suggested change
|
||||||||||
| end | ||||||||||
| <%- else -%> | ||||||||||
| it "does something useful" do | ||||||||||
| expect(false).to eq(true) | ||||||||||
| end | ||||||||||
| <%- end -%> | ||||||||||
| end | ||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/