rbs 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/.github/dependabot.yml +1 -1
  4. data/.github/workflows/bundle-update.yml +3 -3
  5. data/.github/workflows/c-check.yml +2 -2
  6. data/.github/workflows/changelog.yml +121 -0
  7. data/.github/workflows/comments.yml +2 -2
  8. data/.github/workflows/dependabot.yml +1 -1
  9. data/.github/workflows/jruby.yml +4 -9
  10. data/.github/workflows/release-gems.yml +234 -0
  11. data/.github/workflows/ruby.yml +6 -6
  12. data/.github/workflows/rust.yml +12 -12
  13. data/.github/workflows/truffleruby.yml +2 -2
  14. data/.github/workflows/typecheck.yml +2 -2
  15. data/.github/workflows/wasm.yml +3 -3
  16. data/.github/workflows/windows.yml +2 -2
  17. data/.rubocop.yml +0 -1
  18. data/CHANGELOG.md +83 -0
  19. data/README.md +1 -1
  20. data/Rakefile +443 -86
  21. data/config.yml +7 -0
  22. data/core/io.rbs +2 -1
  23. data/docs/CONTRIBUTING.md +1 -1
  24. data/docs/release.md +265 -31
  25. data/docs/stdlib.md +8 -0
  26. data/docs/syntax.md +12 -0
  27. data/ext/rbs_extension/ast_translation.c +15 -0
  28. data/ext/rbs_extension/class_constants.c +2 -0
  29. data/ext/rbs_extension/class_constants.h +1 -0
  30. data/ext/rbs_extension/main.c +55 -19
  31. data/include/rbs/ast.h +25 -17
  32. data/include/rbs/defines.h +8 -3
  33. data/include/rbs/lexer.h +13 -12
  34. data/include/rbs/parser.h +37 -3
  35. data/lib/rbs/ast/declarations.rb +1 -1
  36. data/lib/rbs/ast/type_param.rb +1 -1
  37. data/lib/rbs/definition_builder/ancestor_builder.rb +8 -5
  38. data/lib/rbs/definition_builder/method_builder.rb +4 -4
  39. data/lib/rbs/definition_builder.rb +5 -2
  40. data/lib/rbs/environment/class_entry.rb +12 -0
  41. data/lib/rbs/environment/module_entry.rb +26 -1
  42. data/lib/rbs/parser_aux.rb +2 -2
  43. data/lib/rbs/prototype/helpers.rb +19 -52
  44. data/lib/rbs/prototype/runtime/value_object_generator.rb +0 -1
  45. data/lib/rbs/prototype/runtime.rb +1 -1
  46. data/lib/rbs/types.rb +44 -2
  47. data/lib/rbs/unit_test/type_assertions.rb +5 -5
  48. data/lib/rbs/version.rb +1 -1
  49. data/lib/rbs/wasm/parser.rb +62 -25
  50. data/lib/rbs/wasm/runtime.rb +19 -4
  51. data/lib/rbs/wasm/serialization_schema.rb +3 -2
  52. data/rbs.gemspec +1 -5
  53. data/schema/function.json +12 -1
  54. data/sig/environment/class_entry.rbs +6 -0
  55. data/sig/environment/module_entry.rbs +15 -0
  56. data/sig/parser.rbs +4 -4
  57. data/sig/types.rbs +11 -1
  58. data/sig/unit_test/type_assertions.rbs +2 -2
  59. data/src/ast.c +19 -3
  60. data/src/lexer.c +1562 -1560
  61. data/src/lexer.re +50 -18
  62. data/src/lexstate.c +2 -1
  63. data/src/parser.c +136 -73
  64. data/src/serialize.c +20 -13
  65. data/src/util/rbs_encoding.c +195 -49
  66. data/stdlib/erb/0/erb.rbs +4 -4
  67. data/stdlib/monitor/0/monitor.rbs +4 -4
  68. data/stdlib/singleton/0/singleton.rbs +3 -0
  69. data/stdlib/stringio/0/stringio.rbs +2 -1
  70. data/stdlib/zlib/0/gzip_file.rbs +1 -1
  71. data/stdlib/zlib/0/gzip_writer.rbs +2 -1
  72. data/wasm/README.md +53 -4
  73. data/wasm/rbs_wasm.c +93 -37
  74. metadata +6 -4
  75. data/.github/workflows/milestone.yml +0 -91
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cb4ca04de969abdc9d7f58e67fb98a0ce0d39e6669dab1be23241ba08a1b883
4
- data.tar.gz: c758f606ee5737b64c45fd4da9c99f6522f1a62a0b8a37b4023d37fcb69b6d59
3
+ metadata.gz: 3e76f94a794b829effcba20a9dc637da54915d4bb3a87fa1b4200c4091fa60a6
4
+ data.tar.gz: 5f6eb47e5f31023f56ccede03402493f223719fa5dc1033995fecc592e87e2f1
5
5
  SHA512:
6
- metadata.gz: 26dbbd5af3941363c80a282d63dfda59d0aba521bea2c75e45c3dd58336a18920d859ef426b0c8bab67535be7e3651f8f2f83a78ed068477dd5ccf8adb09df4c
7
- data.tar.gz: 0a5c85aa87e7ddb72519953952bb0bec098c8322cd379fb0e5e8dfb6ac0b1a8f4df70ee225cb3361b719d0b506b5d9eff0c43db08ce235d7ac233adb320d9d8a
6
+ metadata.gz: 168b150476b5515f06f4bc72a58854bc2c60cf073365761ceacf9dc48a5be22d41a0469c168e76ac9d85d03fbdb0e67ac2f7d3564ee6055191432514ff56b10c
7
+ data.tar.gz: 80e89dae7445279f1ee30c825280af61259363911fc78032812dfd1be5f4fc7677598732ca42b3366dff2bc1269fe8b7cd8e6bfa49ccd8a225fe318285bfdfb1
data/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ src/lexer.c linguist-generated
@@ -21,4 +21,4 @@ updates:
21
21
  schedule:
22
22
  interval: 'weekly'
23
23
  labels:
24
- - 'no-milestone'
24
+ - 'skip-changelog'
@@ -11,10 +11,10 @@ jobs:
11
11
 
12
12
  steps:
13
13
  - name: Checkout repository
14
- uses: actions/checkout@v7
14
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
15
15
 
16
16
  - name: Set up Ruby
17
- uses: ruby/setup-ruby@v1
17
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
18
18
  with:
19
19
  ruby-version: '4.0'
20
20
 
@@ -58,6 +58,6 @@ jobs:
58
58
  --body "Automated weekly bundle update" \
59
59
  --head "$(git rev-parse --abbrev-ref HEAD)" \
60
60
  --base "${{ github.event.repository.default_branch }}" \
61
- --label "no-milestone"
61
+ --label "skip-changelog"
62
62
 
63
63
  gh pr merge --auto --merge "$(git rev-parse --abbrev-ref HEAD)"
@@ -14,8 +14,8 @@ jobs:
14
14
  format-check:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
- - uses: actions/checkout@v7
18
- - uses: ruby/setup-ruby@v1
17
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
18
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
19
19
  with:
20
20
  ruby-version: "4.0"
21
21
  bundler-cache: none
@@ -0,0 +1,121 @@
1
+ name: Changelog
2
+
3
+ # Prints the changelog template for a release, which is otherwise `rake gem:changelog`
4
+ # on a laptop.
5
+ #
6
+ # The task asks GitHub which pull requests the commits came from, and it asks through
7
+ # `gh`. A Claude Code on the web session cannot reach `api.github.com` at all -- the
8
+ # refusal is keyed on the session, so neither installing `gh` nor rewriting the task
9
+ # against REST gets around it -- and a runner has both `gh` and `github.token`. So the
10
+ # same task runs here, and the release is prepared from a session that could not
11
+ # otherwise produce this list.
12
+ #
13
+ # The ref selector picks the branch the changelog is for *and* the copy of the task
14
+ # that computes it, which are the same thing: dispatch it on `aaa-X.Y.x` for a patch
15
+ # release, on `master` otherwise.
16
+ #
17
+ # Nothing is written. The run reads the repository and prints.
18
+
19
+ on:
20
+ workflow_dispatch:
21
+ inputs:
22
+ version:
23
+ description: "Where the changelog starts, if not the RBS::VERSION of the ref (e.g. 4.1.0)"
24
+ required: false
25
+ type: string
26
+ format:
27
+ description: "The changelog template, or the JSON its sections are sorted from"
28
+ required: false
29
+ default: list
30
+ type: choice
31
+ options:
32
+ - list
33
+ - json
34
+
35
+ permissions:
36
+ contents: read
37
+
38
+ jobs:
39
+ changelog:
40
+ name: changelog
41
+ runs-on: ubuntu-latest
42
+ permissions:
43
+ contents: read # the history and the tags
44
+ pull-requests: read # what the commits came from
45
+ env:
46
+ # The inputs are read through the environment rather than interpolated into
47
+ # the script below.
48
+ VERSION: ${{ inputs.version }}
49
+ FORMAT: ${{ inputs.format }}
50
+ GH_TOKEN: ${{ github.token }}
51
+ steps:
52
+ # `changelog_base` resolves the previous release with `git describe`, the task
53
+ # walks the history back to it, and on a release branch it reads the `-x`
54
+ # trailers of the commits it finds -- so the full history and the tags are all
55
+ # needed. `fetch-depth: 0` fetches both.
56
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
57
+ with:
58
+ fetch-depth: 0
59
+
60
+ # Before the gems are installed, since a version that cannot be a version is
61
+ # cheapest to reject here.
62
+ - name: Check the input
63
+ run: |
64
+ version_pattern='^[0-9]+\.[0-9]+\.[0-9]+(\.(pre|dev)\.[0-9]+)?$'
65
+ if [ -n "$VERSION" ] && ! [[ "$VERSION" =~ $version_pattern ]]; then
66
+ echo "::error::\`$VERSION\` is not a version number."
67
+ exit 1
68
+ fi
69
+
70
+ - name: Set up Ruby
71
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
72
+ with:
73
+ ruby-version: ruby
74
+ bundler: none
75
+ - name: Install gems
76
+ run: |
77
+ bundle config set --local without libs:profilers
78
+ bundle install --jobs 4 --retry 3
79
+
80
+ # Only the changelog goes to STDOUT; the task reports what it is doing, and
81
+ # which pull requests it skipped, on STDERR. `tee` keeps both in the log, in
82
+ # order, and puts the changelog on its own where the next step can read it.
83
+ - name: Print the changelog
84
+ run: |
85
+ if [ "$FORMAT" = "json" ]; then
86
+ task="gem:changelog:json"
87
+ else
88
+ task="gem:changelog"
89
+ fi
90
+ if [ -n "$VERSION" ]; then
91
+ task="$task[$VERSION]"
92
+ fi
93
+
94
+ echo "Running \`rake $task\` on $(git rev-parse --abbrev-ref HEAD)"
95
+ bundle exec rake "$task" | tee changelog.out
96
+
97
+ # Uploaded before it is rendered, so that the changelog survives whatever the
98
+ # summary makes of it. This is also what to reach for when the JSON is long
99
+ # enough to be truncated in the log.
100
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
101
+ with:
102
+ name: changelog
103
+ path: changelog.out
104
+
105
+ # The log carries this too, but the summary renders it. A step summary is
106
+ # capped at 1MiB and the step fails if that is exceeded, which a long JSON
107
+ # could manage -- so past a comfortable fraction of it, link the artifact
108
+ # rather than lose the run over formatting.
109
+ - name: Render the changelog
110
+ run: |
111
+ if [ "$(wc -c < changelog.out)" -gt 900000 ]; then
112
+ echo "The changelog is too long to render here. Download the \`changelog\` artifact." \
113
+ >> "$GITHUB_STEP_SUMMARY"
114
+ exit 0
115
+ fi
116
+
117
+ {
118
+ echo '```markdown'
119
+ cat changelog.out
120
+ echo '```'
121
+ } >> "$GITHUB_STEP_SUMMARY"
@@ -13,8 +13,8 @@ jobs:
13
13
  # env:
14
14
  # RUBY_COMMIT: v4.0.0-preview2
15
15
  steps:
16
- - uses: actions/checkout@v7
17
- - uses: ruby/setup-ruby@v1
16
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
17
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
18
18
  with:
19
19
  ruby-version: "4.0.6"
20
20
  bundler: none
@@ -17,7 +17,7 @@ jobs:
17
17
  uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
18
18
  id: metadata
19
19
  - name: Checkout repository
20
- uses: actions/checkout@v7
20
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
21
21
  with:
22
22
  fetch-depth: 0
23
23
  - name: Abort if blocker files are changed
@@ -33,13 +33,13 @@ jobs:
33
33
  name: jruby
34
34
  runs-on: ubuntu-latest
35
35
  steps:
36
- - uses: actions/checkout@v7
36
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
37
37
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
38
38
 
39
39
  # Build the .wasm and fetch the Chicory jars with CRuby + the WASI SDK,
40
40
  # then run RBS itself on JRuby against those artifacts.
41
41
  - name: Set up Ruby (to assemble the WebAssembly runtime)
42
- uses: ruby/setup-ruby@v1
42
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
43
43
  with:
44
44
  ruby-version: ruby
45
45
  bundler: none
@@ -59,17 +59,12 @@ jobs:
59
59
  run: bundle exec rake wasm:jruby_setup
60
60
 
61
61
  - name: Set up JRuby
62
- uses: ruby/setup-ruby@v1
62
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
63
63
  with:
64
64
  ruby-version: jruby
65
65
  bundler: none
66
66
  - name: Install runtime and test gems
67
- # rdoc 8.0.0 added a runtime dependency on rbs, which pulls the released
68
- # C-extension rbs gem and fails to build on JRuby. Pin rdoc below 8 until
69
- # a -java rbs gem is published.
70
- run: |
71
- gem install prism rake rake-compiler test-unit rspec minitest json-schema pry --no-document
72
- gem install rdoc -v "< 8" --no-document
67
+ run: gem install prism rake rake-compiler test-unit rdoc rspec minitest json-schema pry --no-document
73
68
  # jar-dependencies resolves through the JVM, so download the Chicory/ASM
74
69
  # jars into ~/.m2 here on JRuby (jar-dependencies is not available in the
75
70
  # CRuby step above).
@@ -0,0 +1,234 @@
1
+ name: Release gems
2
+
3
+ # Builds, publishes, and announces a release. Dispatch it with the commit being
4
+ # released and the version that commit declares.
5
+ #
6
+ # Everything is built from `commit`, not from wherever the default branch happens to
7
+ # be when the run starts, so the release describes a state that is already immutable.
8
+ # `version` is the same fact stated a second time -- the run stops before anything is
9
+ # built unless it matches the `RBS::VERSION` of that commit, so dispatching the wrong
10
+ # commit, or the right one under the wrong name, is a failed run rather than a gem
11
+ # that has to be yanked.
12
+ #
13
+ # `dry_run` builds and checks both gems and stops before the tag, which is how the
14
+ # build is exercised without releasing anything.
15
+ #
16
+ # | Gem | Platform | Parser |
17
+ # | -------------------- | ------------- | -------------------------------- |
18
+ # | `rbs-X.Y.Z.gem` | `ruby` (MRI) | C extension, compiled on install |
19
+ # | `rbs-X.Y.Z-java.gem` | `java` (JRuby)| `rbs_parser.wasm`, prebuilt here |
20
+ #
21
+ # See docs/release.md. The `java` gem is built on CRuby: the platform comes from
22
+ # `RBS_PLATFORM`, not from the engine running `gem build`. JRuby is only needed to
23
+ # run the result, which the workflow does before it would publish anything.
24
+ #
25
+ # One job on purpose. Tagging, pushing the gems, and opening the GitHub release
26
+ # all belong to a single release, and keeping them in one place keeps their order
27
+ # readable -- the tag is created once both gems are known to build and run, and
28
+ # before anything is published, so the reversible step comes before the irreversible
29
+ # one.
30
+ #
31
+ # The file name is what the RubyGems trusted publisher for `rbs` is registered
32
+ # against, so it cannot be renamed without registering the new name first.
33
+
34
+ on:
35
+ workflow_dispatch:
36
+ inputs:
37
+ commit:
38
+ description: "Commit to release, as a full 40-character SHA"
39
+ required: true
40
+ version:
41
+ description: "Version to release, without the leading `v` (e.g. `4.1.2`)"
42
+ required: true
43
+ dry_run:
44
+ description: "Build and check the gems without tagging or publishing anything"
45
+ type: boolean
46
+ default: false
47
+
48
+ permissions:
49
+ contents: read
50
+
51
+ env:
52
+ # Keep in sync with .github/workflows/wasm.yml and .github/workflows/jruby.yml.
53
+ WASI_SDK_VERSION: "33"
54
+ WASI_SDK_RELEASE: "33.0"
55
+
56
+ jobs:
57
+ release:
58
+ name: release
59
+ runs-on: ubuntu-latest
60
+ permissions:
61
+ contents: write # push the tag, publish the GitHub release
62
+ id-token: write # trusted publishing to RubyGems
63
+ env:
64
+ # The inputs are read through the environment rather than interpolated into
65
+ # the scripts below.
66
+ COMMIT: ${{ inputs.commit }}
67
+ VERSION: ${{ inputs.version }}
68
+ TAG: v${{ inputs.version }}
69
+ steps:
70
+ # The gemspec takes its file list from `git ls-files`, so both gems are built
71
+ # from the committed state -- of the dispatched commit, since that is what is
72
+ # checked out. The full history is needed to tell which branches contain it.
73
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
74
+ with:
75
+ ref: ${{ inputs.commit }}
76
+ fetch-depth: 0
77
+
78
+ # Before anything is installed or built: these are the two things the release
79
+ # is named after and built from, and a mistake in either is cheapest to catch
80
+ # here.
81
+ - name: Check the inputs
82
+ run: |
83
+ if [[ ! "$COMMIT" =~ ^[0-9a-f]{40}$ ]]; then
84
+ echo "::error::\`$COMMIT\` is not a full 40-character SHA. A release names one exact commit."
85
+ exit 1
86
+ fi
87
+ if [[ ! "$VERSION" =~ ^[0-9][0-9a-zA-Z.]*$ ]]; then
88
+ echo "::error::\`$VERSION\` is not a version number. Pass it without the leading \`v\`."
89
+ exit 1
90
+ fi
91
+
92
+ # A release proper is cut from the default branch, while a patch release can
93
+ # be cut from a release branch, so which branch the commit is on is not this
94
+ # workflow's business. That it is on one is: a commit no branch contains is
95
+ # one that nothing in the repository leads to any more.
96
+ git fetch --no-tags origin "+refs/heads/*:refs/remotes/origin/*"
97
+ branches=$(git branch --remotes --contains "$COMMIT" --format "%(refname:lstrip=3)")
98
+ if [ -z "$branches" ]; then
99
+ echo "::error::$COMMIT is not on any branch."
100
+ exit 1
101
+ fi
102
+ echo "Branches containing $COMMIT:"
103
+ printf '%s\n' "$branches"
104
+
105
+ # A tag that already exists is a version that has already been released, and
106
+ # pushing it would fail after the build rather than before it.
107
+ - name: Check that the tag does not exist
108
+ if: ${{ !inputs.dry_run }}
109
+ run: |
110
+ if git ls-remote --exit-code --tags origin "refs/tags/$TAG" > /dev/null; then
111
+ echo "::error::$TAG already exists, so $VERSION has been released."
112
+ exit 1
113
+ fi
114
+
115
+ - name: Set up Ruby
116
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
117
+ with:
118
+ ruby-version: ruby
119
+ bundler: none
120
+ - name: Update rubygems & bundler
121
+ run: gem update --system
122
+ - name: Install gems
123
+ run: |
124
+ bundle config set --local without libs:profilers
125
+ bundle install --jobs 4 --retry 3
126
+
127
+ # Fails before a minute is spent on the build, and before anything is pushed:
128
+ # the version has to be the one the released commit declares, and -- unless
129
+ # this is a `.dev.N` release -- the one CHANGELOG.md is written up for.
130
+ - name: Check the version and the changelog
131
+ run: bundle exec rake "gem:check_release[$VERSION]"
132
+
133
+ - name: Build the ruby gem
134
+ run: |
135
+ mkdir -p pkg
136
+ gem build rbs.gemspec -o "pkg/rbs-$VERSION.gem"
137
+
138
+ # `rake wasm:jruby_setup` compiles src/**/*.c to WebAssembly and copies the
139
+ # result to lib/rbs/wasm/, where the gemspec picks it up. clang runs as a
140
+ # subprocess, so this works on CRuby.
141
+ - name: Install the WASI SDK
142
+ run: |
143
+ url="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_RELEASE}-x86_64-linux.tar.gz"
144
+ mkdir -p "$HOME/wasi-sdk"
145
+ curl -sSL "$url" | tar xz --strip-components=1 -C "$HOME/wasi-sdk"
146
+ echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> "$GITHUB_ENV"
147
+ - name: Build rbs_parser.wasm
148
+ run: bundle exec rake wasm:jruby_setup
149
+
150
+ - name: Build the java gem
151
+ env:
152
+ RBS_PLATFORM: java
153
+ run: gem build rbs.gemspec -o "pkg/rbs-$VERSION-java.gem"
154
+
155
+ # `git ls-files` vouches for everything else, but rbs_parser.wasm is a build
156
+ # artifact, so the java gem is the one that can come out quietly wrong.
157
+ - name: Check the built gems
158
+ run: |
159
+ ruby -rrubygems/package -e '
160
+ ruby_gem, java_gem = ARGV.map { Gem::Package.new(_1).spec }
161
+
162
+ raise "unexpected platform: #{ruby_gem.platform}" unless ruby_gem.platform.to_s == "ruby"
163
+ raise "the C extension is not declared" if ruby_gem.extensions.empty?
164
+
165
+ raise "unexpected platform: #{java_gem.platform}" unless java_gem.platform.to_s == "java"
166
+ raise "rbs_parser.wasm is missing" unless java_gem.files.include?("lib/rbs/wasm/rbs_parser.wasm")
167
+ raise "the java gem must not declare an extension" unless java_gem.extensions.empty?
168
+
169
+ [ruby_gem, java_gem].each { puts "#{_1.full_name}: #{_1.files.size} files" }
170
+ ' "pkg/rbs-$VERSION.gem" "pkg/rbs-$VERSION-java.gem"
171
+
172
+ # The checks above cannot tell whether rbs_parser.wasm actually runs. Install
173
+ # the gem the way a user would -- jar-dependencies fetches Chicory and ASM
174
+ # from Maven during the install -- and parse something with it, so the
175
+ # WebAssembly runtime is exercised end to end before anything is published.
176
+ - name: Set up JRuby
177
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
178
+ with:
179
+ ruby-version: jruby
180
+ bundler: none
181
+ - name: Check the java gem on JRuby
182
+ run: |
183
+ gem install "pkg/rbs-$VERSION-java.gem"
184
+ ruby -e '
185
+ require "rbs"
186
+ _, _, decls = RBS::Parser.parse_signature("class Foo end")
187
+ names = decls.map { _1.name.to_s }
188
+ raise "parsed #{names.inspect}, expected [\"Foo\"]" unless names == ["Foo"]
189
+ puts "#{RUBY_ENGINE} #{RUBY_VERSION}: rbs #{RBS::VERSION} parses through the WebAssembly runtime"
190
+ '
191
+
192
+ - name: Switch back to CRuby
193
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
194
+ with:
195
+ ruby-version: ruby
196
+ bundler: none
197
+
198
+ # Uploaded before publishing, so a failed push still leaves the gems behind.
199
+ # This is also where a dry run ends.
200
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
201
+ with:
202
+ name: gems
203
+ path: pkg/*.gem
204
+ if-no-files-found: error
205
+
206
+ # Everything below runs only for a real release.
207
+
208
+ # The tag comes after the gems are known to build and run, and before anything
209
+ # is published: a tag can be deleted, while a version pushed to RubyGems can
210
+ # only be yanked. What it names was decided by the checkout rather than by the
211
+ # tagging, so nothing rests on it being created first.
212
+ - name: Tag the release
213
+ if: ${{ !inputs.dry_run }}
214
+ run: |
215
+ git config user.name "github-actions[bot]"
216
+ git config user.email "github-actions[bot]@users.noreply.github.com"
217
+ bundle exec rake gem:tag
218
+
219
+ - name: Configure RubyGems credentials
220
+ if: ${{ !inputs.dry_run }}
221
+ uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
222
+
223
+ - name: Push the gems
224
+ if: ${{ !inputs.dry_run }}
225
+ run: |
226
+ gem push "pkg/rbs-$VERSION.gem"
227
+ gem push "pkg/rbs-$VERSION-java.gem"
228
+
229
+ # Last, so that a failed push never announces a release that has no gems.
230
+ - name: Publish the GitHub release
231
+ if: ${{ !inputs.dry_run }}
232
+ env:
233
+ GH_TOKEN: ${{ github.token }}
234
+ run: bundle exec rake gem:gh_release
@@ -40,8 +40,8 @@ jobs:
40
40
  env:
41
41
  RANDOMIZE_STDLIB_TEST_ORDER: "true"
42
42
  steps:
43
- - uses: actions/checkout@v7
44
- - uses: ruby/setup-ruby@v1
43
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
44
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
45
45
  with:
46
46
  ruby-version: ${{ matrix.ruby }}
47
47
  bundler: none
@@ -90,11 +90,11 @@ jobs:
90
90
  matrix:
91
91
  ruby: ['4.0', head]
92
92
  steps:
93
- - uses: actions/checkout@v7
93
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
94
94
  - name: Install dependencies
95
95
  run: |
96
96
  brew install ruby-build
97
- - uses: ruby/setup-ruby@v1
97
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
98
98
  with:
99
99
  ruby-version: ${{ matrix.ruby }}
100
100
  bundler: none
@@ -127,11 +127,11 @@ jobs:
127
127
  matrix:
128
128
  ruby: ['4.0', head]
129
129
  steps:
130
- - uses: actions/checkout@v7
130
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
131
131
  - name: Install dependencies
132
132
  run: |
133
133
  brew install ruby-build
134
- - uses: ruby/setup-ruby@v1
134
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
135
135
  with:
136
136
  ruby-version: ${{ matrix.ruby }}
137
137
  bundler: none
@@ -26,10 +26,10 @@ jobs:
26
26
  matrix:
27
27
  os: [ubuntu-latest, macos-latest, windows-latest]
28
28
  steps:
29
- - uses: actions/checkout@v7
29
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30
30
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
31
31
  - name: Set up Ruby
32
- uses: ruby/setup-ruby@v1
32
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
33
33
  with:
34
34
  ruby-version: ruby
35
35
  bundler: none
@@ -45,7 +45,7 @@ jobs:
45
45
  run: |
46
46
  rustup update --no-self-update stable
47
47
  rustup default stable
48
- - uses: actions/cache@v6
48
+ - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
49
49
  with:
50
50
  path: |
51
51
  ~/.cargo/registry
@@ -64,14 +64,14 @@ jobs:
64
64
  runs-on: ubuntu-latest
65
65
  continue-on-error: true
66
66
  steps:
67
- - uses: actions/checkout@v7
67
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
68
68
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
69
69
  - name: Set up git identity
70
70
  run: |
71
71
  git config user.name "GitHub Actions"
72
72
  git config user.email "actions@github.com"
73
73
  - name: Set up Ruby
74
- uses: ruby/setup-ruby@v1
74
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
75
75
  with:
76
76
  ruby-version: ruby
77
77
  bundler: none
@@ -87,7 +87,7 @@ jobs:
87
87
  run: |
88
88
  rustup update --no-self-update stable
89
89
  rustup default stable
90
- - uses: actions/cache@v6
90
+ - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
91
91
  with:
92
92
  path: |
93
93
  ~/.cargo/registry
@@ -106,14 +106,14 @@ jobs:
106
106
  runs-on: ubuntu-latest
107
107
  continue-on-error: true
108
108
  steps:
109
- - uses: actions/checkout@v7
109
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
110
110
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
111
111
  - name: Set up git identity
112
112
  run: |
113
113
  git config user.name "GitHub Actions"
114
114
  git config user.email "actions@github.com"
115
115
  - name: Set up Ruby
116
- uses: ruby/setup-ruby@v1
116
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
117
117
  with:
118
118
  ruby-version: ruby
119
119
  bundler: none
@@ -129,7 +129,7 @@ jobs:
129
129
  run: |
130
130
  rustup update --no-self-update stable
131
131
  rustup default stable
132
- - uses: actions/cache@v6
132
+ - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
133
133
  with:
134
134
  path: |
135
135
  ~/.cargo/registry
@@ -147,10 +147,10 @@ jobs:
147
147
  name: cargo:lint
148
148
  runs-on: ubuntu-latest
149
149
  steps:
150
- - uses: actions/checkout@v7
150
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
151
151
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
152
152
  - name: Set up Ruby
153
- uses: ruby/setup-ruby@v1
153
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
154
154
  with:
155
155
  ruby-version: ruby
156
156
  bundler: none
@@ -167,7 +167,7 @@ jobs:
167
167
  rustup update --no-self-update stable
168
168
  rustup default stable
169
169
  rustup component add --toolchain stable clippy rustfmt
170
- - uses: actions/cache@v6
170
+ - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
171
171
  with:
172
172
  path: |
173
173
  ~/.cargo/registry
@@ -24,8 +24,8 @@ jobs:
24
24
  # TruffleRuby warns and falls back to US-ASCII unless the locale is UTF-8.
25
25
  LANG: "en_US.UTF-8"
26
26
  steps:
27
- - uses: actions/checkout@v7
28
- - uses: ruby/setup-ruby@v1
27
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
29
29
  with:
30
30
  ruby-version: ${{ matrix.ruby }}
31
31
  bundler: none
@@ -16,8 +16,8 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  steps:
19
- - uses: actions/checkout@v7
20
- - uses: ruby/setup-ruby@v1
19
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
21
21
  with:
22
22
  ruby-version: "4.0"
23
23
  bundler: none
@@ -28,10 +28,10 @@ jobs:
28
28
  name: wasm:check
29
29
  runs-on: ubuntu-latest
30
30
  steps:
31
- - uses: actions/checkout@v7
31
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
32
32
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
33
33
  - name: Set up Ruby
34
- uses: ruby/setup-ruby@v1
34
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
35
35
  with:
36
36
  ruby-version: ruby
37
37
  bundler: none
@@ -48,7 +48,7 @@ jobs:
48
48
  curl -sSL "$url" | tar xz --strip-components=1 -C "$HOME/wasi-sdk"
49
49
  echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> "$GITHUB_ENV"
50
50
  - name: Install wasmtime
51
- uses: bytecodealliance/actions/wasmtime/setup@v1
51
+ uses: bytecodealliance/actions/wasmtime/setup@9152e710e9f7182e4c29ad218e4f335a7b203613 # v1.1.3
52
52
  with:
53
53
  version: ${{ env.WASMTIME_VERSION }}
54
54
  - name: Build and smoke-test the WebAssembly module
@@ -18,9 +18,9 @@ jobs:
18
18
  matrix:
19
19
  ruby: ['4.0', ucrt, mswin]
20
20
  steps:
21
- - uses: actions/checkout@v7
21
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
22
  - name: load ruby
23
- uses: ruby/setup-ruby@v1
23
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
24
24
  with:
25
25
  ruby-version: ${{ matrix.ruby }}
26
26
 
data/.rubocop.yml CHANGED
@@ -3,7 +3,6 @@ plugins:
3
3
  - rubocop-on-rbs
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 3.4
7
6
  DisabledByDefault: true
8
7
  Exclude:
9
8
  - 'vendor/bundle/**/*'