rbs 4.1.0.pre.1 → 4.1.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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +37 -0
  3. data/.github/workflows/bundle-update.yml +1 -1
  4. data/.github/workflows/c-check.yml +14 -6
  5. data/.github/workflows/comments.yml +2 -2
  6. data/.github/workflows/dependabot.yml +2 -2
  7. data/.github/workflows/jruby.yml +79 -0
  8. data/.github/workflows/milestone.yml +13 -2
  9. data/.github/workflows/ruby.yml +16 -4
  10. data/.github/workflows/rust.yml +13 -8
  11. data/.github/workflows/truffleruby.yml +54 -0
  12. data/.github/workflows/typecheck.yml +5 -2
  13. data/.github/workflows/wasm.yml +55 -0
  14. data/.github/workflows/windows.yml +8 -2
  15. data/.gitignore +8 -0
  16. data/CHANGELOG.md +88 -0
  17. data/Dockerfile.jruby +53 -0
  18. data/README.md +3 -3
  19. data/Rakefile +103 -1
  20. data/Steepfile +9 -0
  21. data/core/array.rbs +243 -180
  22. data/core/builtin.rbs +6 -6
  23. data/core/enumerable.rbs +109 -109
  24. data/core/enumerator/product.rbs +5 -5
  25. data/core/enumerator.rbs +28 -28
  26. data/core/file.rbs +24 -1018
  27. data/core/file_constants.rbs +463 -0
  28. data/core/file_stat.rbs +534 -0
  29. data/core/float.rbs +0 -24
  30. data/core/hash.rbs +117 -101
  31. data/core/integer.rbs +21 -58
  32. data/core/io.rbs +25 -7
  33. data/core/match_data.rbs +1 -1
  34. data/core/module.rbs +88 -74
  35. data/core/numeric.rbs +3 -0
  36. data/core/object_space/weak_key_map.rbs +7 -7
  37. data/core/pathname.rbs +0 -10
  38. data/core/ractor.rbs +0 -10
  39. data/core/range.rbs +23 -23
  40. data/core/rbs/ops.rbs +154 -0
  41. data/core/rbs/unnamed/argf.rbs +3 -3
  42. data/core/rubygems/errors.rbs +4 -1
  43. data/core/rubygems/requirement.rbs +0 -10
  44. data/core/rubygems/rubygems.rbs +4 -1
  45. data/core/rubygems/specification.rbs +8 -0
  46. data/core/rubygems/version.rbs +0 -160
  47. data/core/set.rbs +3 -3
  48. data/core/struct.rbs +16 -16
  49. data/core/thread.rbs +9 -14
  50. data/docs/CONTRIBUTING.md +2 -1
  51. data/docs/inline.md +36 -6
  52. data/docs/rbs_by_example.md +20 -20
  53. data/docs/release.md +69 -0
  54. data/docs/syntax.md +2 -2
  55. data/docs/wasm_serialization.md +80 -0
  56. data/ext/rbs_extension/ast_translation.c +1294 -973
  57. data/ext/rbs_extension/ast_translation.h +4 -0
  58. data/ext/rbs_extension/legacy_location.c +11 -6
  59. data/ext/rbs_extension/main.c +139 -4
  60. data/include/rbs/ast.h +9 -1
  61. data/include/rbs/serialize.h +39 -0
  62. data/lib/rbs/ast/ruby/comment_block.rb +6 -4
  63. data/lib/rbs/ast/ruby/helpers/location_helper.rb +1 -1
  64. data/lib/rbs/ast/ruby/members.rb +12 -1
  65. data/lib/rbs/buffer.rb +48 -11
  66. data/lib/rbs/collection/sources/git.rb +6 -0
  67. data/lib/rbs/definition_builder/method_builder.rb +12 -6
  68. data/lib/rbs/environment.rb +4 -3
  69. data/lib/rbs/inline_parser.rb +5 -3
  70. data/lib/rbs/namespace.rb +47 -11
  71. data/lib/rbs/parser_aux.rb +4 -2
  72. data/lib/rbs/prototype/rbi.rb +193 -25
  73. data/lib/rbs/prototype/runtime.rb +2 -0
  74. data/lib/rbs/resolver/type_name_resolver.rb +12 -14
  75. data/lib/rbs/type_name.rb +33 -13
  76. data/lib/rbs/unit_test/type_assertions.rb +9 -0
  77. data/lib/rbs/version.rb +1 -1
  78. data/lib/rbs/wasm/deserializer.rb +213 -0
  79. data/lib/rbs/wasm/location.rb +61 -0
  80. data/lib/rbs/wasm/parser.rb +137 -0
  81. data/lib/rbs/wasm/runtime.rb +196 -0
  82. data/lib/rbs/wasm/serialization_schema.rb +110 -0
  83. data/lib/rbs.rb +13 -2
  84. data/lib/rbs_jars.rb +39 -0
  85. data/lib/rdoc_plugin/parser.rb +5 -0
  86. data/rbs.gemspec +32 -2
  87. data/sig/ast/ruby/members.rbs +6 -1
  88. data/sig/buffer.rbs +19 -1
  89. data/sig/namespace.rbs +20 -0
  90. data/sig/parser.rbs +10 -0
  91. data/sig/prototype/rbi.rbs +33 -4
  92. data/sig/resolver/type_name_resolver.rbs +2 -4
  93. data/sig/typename.rbs +15 -0
  94. data/sig/unit_test/type_assertions.rbs +4 -0
  95. data/sig/wasm/deserializer.rbs +66 -0
  96. data/sig/wasm/serialization_schema.rbs +13 -0
  97. data/src/ast.c +78 -78
  98. data/src/lexer.c +97 -93
  99. data/src/lexer.re +1 -1
  100. data/src/lexstate.c +9 -1
  101. data/src/serialize.c +958 -0
  102. data/src/util/rbs_allocator.c +14 -8
  103. data/stdlib/abbrev/0/array.rbs +1 -1
  104. data/stdlib/csv/0/csv.rbs +5 -5
  105. data/stdlib/delegate/0/delegator.rbs +2 -1
  106. data/stdlib/digest/0/digest.rbs +11 -5
  107. data/stdlib/erb/0/erb.rbs +1 -1
  108. data/stdlib/etc/0/etc.rbs +18 -4
  109. data/stdlib/fileutils/0/fileutils.rbs +21 -21
  110. data/stdlib/ipaddr/0/ipaddr.rbs +0 -5
  111. data/stdlib/json/0/json.rbs +6 -6
  112. data/stdlib/monitor/0/monitor.rbs +2 -2
  113. data/stdlib/openssl/0/openssl.rbs +44 -38
  114. data/stdlib/resolv/0/resolv.rbs +1 -1
  115. data/stdlib/shellwords/0/shellwords.rbs +1 -1
  116. data/stdlib/stringio/0/stringio.rbs +32 -10
  117. data/stdlib/strscan/0/string_scanner.rbs +74 -55
  118. data/stdlib/tempfile/0/manifest.yaml +3 -0
  119. data/stdlib/timeout/0/timeout.rbs +0 -5
  120. data/stdlib/tsort/0/cyclic.rbs +1 -1
  121. data/stdlib/tsort/0/interfaces.rbs +8 -8
  122. data/stdlib/tsort/0/tsort.rbs +9 -9
  123. data/stdlib/uri/0/generic.rbs +0 -5
  124. data/stdlib/zlib/0/gzip_reader.rbs +2 -2
  125. data/stdlib/zlib/0/zstream.rbs +0 -1
  126. data/wasm/README.md +60 -0
  127. data/wasm/rbs_wasm.c +423 -0
  128. metadata +26 -5
  129. data/.vscode/extensions.json +0 -5
  130. data/.vscode/settings.json +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef0d5eb6481b99be0816dbcef78f1cc40371104f4ef3e82b40ffcbbc3e78dccc
4
- data.tar.gz: a728bc39e8ef49146542b121956fc5555d8eecb066febe271bb04b0beaf56ea3
3
+ metadata.gz: 0cb4ca04de969abdc9d7f58e67fb98a0ce0d39e6669dab1be23241ba08a1b883
4
+ data.tar.gz: c758f606ee5737b64c45fd4da9c99f6522f1a62a0b8a37b4023d37fcb69b6d59
5
5
  SHA512:
6
- metadata.gz: d0a018f3245ae90e747f649b1e306edf8084147a3db4138b929a74736b86fe8f404b3e0d4aef35b212bf8da149e4d7b0088d22b5c1bd27a006aed253dec82d88
7
- data.tar.gz: 65a1efb7bc0484e7744c7df1ef70c193918f5a5d5690c00bdadcb5b29bbf8b5b18719643e31b6ea93b2a4ae56874965b5116f43de1569deb5ff24b96e221a7c7
6
+ metadata.gz: 26dbbd5af3941363c80a282d63dfda59d0aba521bea2c75e45c3dd58336a18920d859ef426b0c8bab67535be7e3651f8f2f83a78ed068477dd5ccf8adb09df4c
7
+ data.tar.gz: 0a5c85aa87e7ddb72519953952bb0bec098c8322cd379fb0e5e8dfb6ac0b1a8f4df70ee225cb3361b719d0b506b5d9eff0c43db08ce235d7ac233adb320d9d8a
data/.dockerignore ADDED
@@ -0,0 +1,37 @@
1
+ # Keep the build context small. .git is intentionally NOT ignored: rbs.gemspec
2
+ # builds its file list with `git ls-files`.
3
+ #
4
+ # Safe to ignore here: untracked/generated paths, and tracked paths the gemspec
5
+ # already rejects (so `gem build` does not expect them on disk). Do NOT ignore a
6
+ # tracked path the gemspec ships — `gem build` would fail with "... are not
7
+ # files". .vscode/ and benchmark/ are tracked but rejected by the gemspec.
8
+ .vscode/
9
+ benchmark/
10
+
11
+ # Editor / tooling / worktree copies (untracked; each is a full repo clone)
12
+ .claude/
13
+ trees/
14
+ .devcontainer/
15
+ .idea/
16
+ .ruby-lsp/
17
+ .yardoc/
18
+ doc/
19
+ datasets/
20
+ tmp/
21
+
22
+ # Build artifact — rebuilt inside the image by `rake wasm:jruby_setup`
23
+ lib/rbs/wasm/*.wasm
24
+ *.gem
25
+ ext/**/*.o
26
+ ext/**/*.so
27
+ ext/**/*.bundle
28
+ *.log
29
+
30
+ # Local scratch / experiment files
31
+ flamegraph.html
32
+ gc.html
33
+ foo.rbs
34
+ sorted.json
35
+ string.json
36
+ Gemfile-*
37
+ gemfiles/
@@ -11,7 +11,7 @@ jobs:
11
11
 
12
12
  steps:
13
13
  - name: Checkout repository
14
- uses: actions/checkout@v6
14
+ uses: actions/checkout@v7
15
15
 
16
16
  - name: Set up Ruby
17
17
  uses: ruby/setup-ruby@v1
@@ -7,11 +7,14 @@ on:
7
7
  pull_request: {}
8
8
  merge_group: {}
9
9
 
10
+ permissions:
11
+ contents: read
12
+
10
13
  jobs:
11
14
  format-check:
12
15
  runs-on: ubuntu-latest
13
16
  steps:
14
- - uses: actions/checkout@v6
17
+ - uses: actions/checkout@v7
15
18
  - uses: ruby/setup-ruby@v1
16
19
  with:
17
20
  ruby-version: "4.0"
@@ -24,8 +27,13 @@ jobs:
24
27
  sudo apt-get install -y libdb-dev curl autoconf automake m4 libtool
25
28
  - name: Install clang-format from LLVM
26
29
  run: |
27
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
28
- sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main"
30
+ # The codename must match the `runs-on` image: `ubuntu-latest` is 24.04 (noble).
31
+ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key \
32
+ | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
33
+ # Written directly rather than through `apt-add-repository`, which cannot
34
+ # parse `[signed-by=...]` inside a one-line `deb` shortcut.
35
+ echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main" \
36
+ | sudo tee /etc/apt/sources.list.d/llvm.list
29
37
  sudo apt-get update
30
38
  sudo apt-get install -y clang-format-20
31
39
  sudo ln -sf /usr/bin/clang-format-20 /usr/local/bin/clang-format
@@ -35,9 +43,9 @@ jobs:
35
43
  - name: Install Re2c
36
44
  run: |
37
45
  cd /tmp
38
- curl -L https://github.com/skvadrik/re2c/archive/refs/tags/4.3.tar.gz > re2c-4.3.tar.gz
39
- tar xf re2c-4.3.tar.gz
40
- cd re2c-4.3
46
+ curl -L https://github.com/skvadrik/re2c/archive/refs/tags/4.5.1.tar.gz > re2c-4.5.1.tar.gz
47
+ tar xf re2c-4.5.1.tar.gz
48
+ cd re2c-4.5.1
41
49
  cmake --preset=linux-gcc-release-ootree-skeleton-fast
42
50
  cmake --build --preset=linux-gcc-release-ootree-skeleton-fast --parallel="$(nproc)"
43
51
  sudo ln -sf "$(pwd)"/.build/linux-gcc-release-ootree-skeleton-fast/re2c /usr/local/bin/re2c
@@ -13,10 +13,10 @@ jobs:
13
13
  # env:
14
14
  # RUBY_COMMIT: v4.0.0-preview2
15
15
  steps:
16
- - uses: actions/checkout@v6
16
+ - uses: actions/checkout@v7
17
17
  - uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "4.0.1"
19
+ ruby-version: "4.0.6"
20
20
  bundler: none
21
21
  - name: Install dependencies
22
22
  run: |
@@ -14,10 +14,10 @@ jobs:
14
14
  if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
15
15
  steps:
16
16
  - name: Dependabot metadata
17
- uses: dependabot/fetch-metadata@ffa630c65fa7e0ecfa0625b5ceda64399aea1b36 # v3.0.0
17
+ uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
18
18
  id: metadata
19
19
  - name: Checkout repository
20
- uses: actions/checkout@v6
20
+ uses: actions/checkout@v7
21
21
  with:
22
22
  fetch-depth: 0
23
23
  - name: Abort if blocker files are changed
@@ -0,0 +1,79 @@
1
+ name: JRuby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ paths:
9
+ - ".github/workflows/jruby.yml"
10
+ - "include/**"
11
+ - "src/**"
12
+ - "wasm/**"
13
+ - "lib/**"
14
+ - "sig/**"
15
+ - "core/**"
16
+ - "stdlib/**"
17
+ - "test/**"
18
+ - "Rakefile"
19
+ - "rbs.gemspec"
20
+ # `merge_group` has no `paths` filter, so this runs on every queue entry.
21
+ merge_group: {}
22
+
23
+ permissions:
24
+ contents: read
25
+
26
+ env:
27
+ # Keep in sync with .github/workflows/wasm.yml.
28
+ WASI_SDK_VERSION: "33"
29
+ WASI_SDK_RELEASE: "33.0"
30
+
31
+ jobs:
32
+ test:
33
+ name: jruby
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v7
37
+ - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
38
+
39
+ # Build the .wasm and fetch the Chicory jars with CRuby + the WASI SDK,
40
+ # then run RBS itself on JRuby against those artifacts.
41
+ - name: Set up Ruby (to assemble the WebAssembly runtime)
42
+ uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ruby
45
+ bundler: none
46
+ - name: Update rubygems & bundler
47
+ run: gem update --system
48
+ - name: Install gems
49
+ run: |
50
+ bundle config set --local without libs:profilers
51
+ bundle install --jobs 4 --retry 3
52
+ - name: Install the WASI SDK
53
+ run: |
54
+ url="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_RELEASE}-x86_64-linux.tar.gz"
55
+ mkdir -p "$HOME/wasi-sdk"
56
+ curl -sSL "$url" | tar xz --strip-components=1 -C "$HOME/wasi-sdk"
57
+ echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> "$GITHUB_ENV"
58
+ - name: Build rbs_parser.wasm
59
+ run: bundle exec rake wasm:jruby_setup
60
+
61
+ - name: Set up JRuby
62
+ uses: ruby/setup-ruby@v1
63
+ with:
64
+ ruby-version: jruby
65
+ bundler: none
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
73
+ # jar-dependencies resolves through the JVM, so download the Chicory/ASM
74
+ # jars into ~/.m2 here on JRuby (jar-dependencies is not available in the
75
+ # CRuby step above).
76
+ - name: Download the Chicory and ASM jars
77
+ run: jruby -S rake wasm:install_jars
78
+ - name: Run the test suite on JRuby
79
+ run: jruby -S rake test
@@ -3,16 +3,26 @@ name: Check milestone
3
3
  on:
4
4
  pull_request:
5
5
  types: [opened, edited, labeled, unlabeled, milestoned, demilestoned, synchronize]
6
+ merge_group: {}
7
+
8
+ permissions:
9
+ contents: read
6
10
 
7
11
  jobs:
8
12
  check:
9
13
  runs-on: ubuntu-latest
10
14
 
11
15
  steps:
12
- - uses: actions/checkout@v6
16
+ # The milestone is a property of the pull request, so there is nothing to
17
+ # check once it enters the merge queue. This job still has to run there
18
+ # because `check` is a required status check -- it just reports success
19
+ # without doing anything.
20
+ - uses: actions/checkout@v7
21
+ if: github.event_name == 'pull_request'
13
22
 
14
23
  - name: Extract RBS::Version
15
24
  id: version
25
+ if: github.event_name == 'pull_request'
16
26
  run: |
17
27
  # Extract version string from lib/rbs/version.rb
18
28
  version=$(ruby -e 'load "lib/rbs/version.rb"; print RBS::VERSION')
@@ -27,7 +37,8 @@ jobs:
27
37
  echo "RBS::VERSION = $version (major=$major, minor=$minor, patch=$patch)"
28
38
 
29
39
  - name: Check milestone
30
- uses: actions/github-script@v8
40
+ if: github.event_name == 'pull_request'
41
+ uses: actions/github-script@v9
31
42
  with:
32
43
  script: |
33
44
  const pr = context.payload.pull_request;
@@ -7,13 +7,16 @@ on:
7
7
  pull_request: {}
8
8
  merge_group: {}
9
9
 
10
+ permissions:
11
+ contents: read
12
+
10
13
  jobs:
11
14
  test:
12
15
  runs-on: "ubuntu-latest"
13
16
  strategy:
14
17
  fail-fast: false
15
18
  matrix:
16
- ruby: ['3.2', '3.3', '3.4', '4.0', head]
19
+ ruby: ['3.3', '3.4', '4.0', head]
17
20
  rubyopt: [""]
18
21
  job:
19
22
  - test
@@ -37,7 +40,7 @@ jobs:
37
40
  env:
38
41
  RANDOMIZE_STDLIB_TEST_ORDER: "true"
39
42
  steps:
40
- - uses: actions/checkout@v6
43
+ - uses: actions/checkout@v7
41
44
  - uses: ruby/setup-ruby@v1
42
45
  with:
43
46
  ruby-version: ${{ matrix.ruby }}
@@ -63,6 +66,9 @@ jobs:
63
66
  if: ${{ contains(matrix.ruby, 'head') }}
64
67
  run: |
65
68
  bundle config set force_ruby_platform true
69
+ - name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head
70
+ if: ${{ contains(matrix.ruby, 'head') }}
71
+ run: bundle config set --local version system
66
72
  - name: Skip installing type checkers
67
73
  if: ${{ ! contains(matrix.job, 'typecheck_test') }}
68
74
  run: |
@@ -84,7 +90,7 @@ jobs:
84
90
  matrix:
85
91
  ruby: ['4.0', head]
86
92
  steps:
87
- - uses: actions/checkout@v6
93
+ - uses: actions/checkout@v7
88
94
  - name: Install dependencies
89
95
  run: |
90
96
  brew install ruby-build
@@ -106,6 +112,9 @@ jobs:
106
112
  if: ${{ contains(matrix.ruby, 'head') }}
107
113
  run: |
108
114
  bundle config set force_ruby_platform true
115
+ - name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head
116
+ if: ${{ contains(matrix.ruby, 'head') }}
117
+ run: bundle config set --local version system
109
118
  - name: bin/setup
110
119
  run: |
111
120
  bin/setup
@@ -118,7 +127,7 @@ jobs:
118
127
  matrix:
119
128
  ruby: ['4.0', head]
120
129
  steps:
121
- - uses: actions/checkout@v6
130
+ - uses: actions/checkout@v7
122
131
  - name: Install dependencies
123
132
  run: |
124
133
  brew install ruby-build
@@ -140,6 +149,9 @@ jobs:
140
149
  if: ${{ contains(matrix.ruby, 'head') }}
141
150
  run: |
142
151
  bundle config set force_ruby_platform true
152
+ - name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head
153
+ if: ${{ contains(matrix.ruby, 'head') }}
154
+ run: bundle config set --local version system
143
155
  - name: bin/setup
144
156
  run: |
145
157
  bin/setup
@@ -8,10 +8,15 @@ on:
8
8
  paths:
9
9
  - ".github/workflows/rust.yml"
10
10
  - "rust/**"
11
+ # `merge_group` has no `paths` filter, so this runs on every queue entry.
12
+ merge_group: {}
11
13
 
12
14
  env:
13
15
  RUSTFLAGS: "-D warnings"
14
16
 
17
+ permissions:
18
+ contents: read
19
+
15
20
  jobs:
16
21
  test:
17
22
  name: cargo:test
@@ -21,7 +26,7 @@ jobs:
21
26
  matrix:
22
27
  os: [ubuntu-latest, macos-latest, windows-latest]
23
28
  steps:
24
- - uses: actions/checkout@v6
29
+ - uses: actions/checkout@v7
25
30
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
26
31
  - name: Set up Ruby
27
32
  uses: ruby/setup-ruby@v1
@@ -40,7 +45,7 @@ jobs:
40
45
  run: |
41
46
  rustup update --no-self-update stable
42
47
  rustup default stable
43
- - uses: actions/cache@v5
48
+ - uses: actions/cache@v6
44
49
  with:
45
50
  path: |
46
51
  ~/.cargo/registry
@@ -59,7 +64,7 @@ jobs:
59
64
  runs-on: ubuntu-latest
60
65
  continue-on-error: true
61
66
  steps:
62
- - uses: actions/checkout@v6
67
+ - uses: actions/checkout@v7
63
68
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
64
69
  - name: Set up git identity
65
70
  run: |
@@ -82,7 +87,7 @@ jobs:
82
87
  run: |
83
88
  rustup update --no-self-update stable
84
89
  rustup default stable
85
- - uses: actions/cache@v5
90
+ - uses: actions/cache@v6
86
91
  with:
87
92
  path: |
88
93
  ~/.cargo/registry
@@ -101,7 +106,7 @@ jobs:
101
106
  runs-on: ubuntu-latest
102
107
  continue-on-error: true
103
108
  steps:
104
- - uses: actions/checkout@v6
109
+ - uses: actions/checkout@v7
105
110
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
106
111
  - name: Set up git identity
107
112
  run: |
@@ -124,7 +129,7 @@ jobs:
124
129
  run: |
125
130
  rustup update --no-self-update stable
126
131
  rustup default stable
127
- - uses: actions/cache@v5
132
+ - uses: actions/cache@v6
128
133
  with:
129
134
  path: |
130
135
  ~/.cargo/registry
@@ -142,7 +147,7 @@ jobs:
142
147
  name: cargo:lint
143
148
  runs-on: ubuntu-latest
144
149
  steps:
145
- - uses: actions/checkout@v6
150
+ - uses: actions/checkout@v7
146
151
  - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
147
152
  - name: Set up Ruby
148
153
  uses: ruby/setup-ruby@v1
@@ -162,7 +167,7 @@ jobs:
162
167
  rustup update --no-self-update stable
163
168
  rustup default stable
164
169
  rustup component add --toolchain stable clippy rustfmt
165
- - uses: actions/cache@v5
170
+ - uses: actions/cache@v6
166
171
  with:
167
172
  path: |
168
173
  ~/.cargo/registry
@@ -0,0 +1,54 @@
1
+ name: TruffleRuby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request: {}
8
+ merge_group: {}
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: "ubuntu-latest"
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: ['truffleruby']
20
+ job:
21
+ - test
22
+ env:
23
+ RANDOMIZE_STDLIB_TEST_ORDER: "true"
24
+ # TruffleRuby warns and falls back to US-ASCII unless the locale is UTF-8.
25
+ LANG: "en_US.UTF-8"
26
+ steps:
27
+ - uses: actions/checkout@v7
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ bundler: none
32
+ - name: Set working directory as safe
33
+ run: git config --global --add safe.directory $(pwd)
34
+ - name: Install dependencies
35
+ run: |
36
+ sudo apt-get update
37
+ sudo apt-get install -y libdb-dev curl autoconf automake m4 libtool python3
38
+ - name: Update rubygems & bundler
39
+ run: |
40
+ ruby -v
41
+ gem update --system
42
+ - name: install erb
43
+ run: gem install erb
44
+ - name: bundle config
45
+ run: |
46
+ # Profilers and the typecheck tooling are not needed for the smoke test,
47
+ # and some of them do not support TruffleRuby.
48
+ bundle config set --local without 'profilers typecheck_test'
49
+ - name: bin/setup
50
+ run: |
51
+ bin/setup
52
+ - name: Run test
53
+ run: |
54
+ bundle exec rake ${{ matrix.job }}
@@ -7,16 +7,19 @@ on:
7
7
  pull_request: {}
8
8
  merge_group: {}
9
9
 
10
+ permissions:
11
+ contents: read
12
+
10
13
  jobs:
11
14
  steep:
12
15
  runs-on: "ubuntu-latest"
13
16
  strategy:
14
17
  fail-fast: false
15
18
  steps:
16
- - uses: actions/checkout@v6
19
+ - uses: actions/checkout@v7
17
20
  - uses: ruby/setup-ruby@v1
18
21
  with:
19
- ruby-version: "3.4"
22
+ ruby-version: "4.0"
20
23
  bundler: none
21
24
  - name: Set working directory as safe
22
25
  run: git config --global --add safe.directory $(pwd)
@@ -0,0 +1,55 @@
1
+ name: WebAssembly
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ paths:
9
+ - ".github/workflows/wasm.yml"
10
+ - "Rakefile"
11
+ - "include/**"
12
+ - "src/**"
13
+ - "wasm/**"
14
+ # `merge_group` has no `paths` filter, so this runs on every queue entry.
15
+ merge_group: {}
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ env:
21
+ # Pinned so the smoke test is reproducible. Bump together when upgrading.
22
+ WASI_SDK_VERSION: "33"
23
+ WASI_SDK_RELEASE: "33.0"
24
+ WASMTIME_VERSION: "v47.0.2"
25
+
26
+ jobs:
27
+ build:
28
+ name: wasm:check
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - uses: actions/checkout@v7
32
+ - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
33
+ - name: Set up Ruby
34
+ uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ruby
37
+ bundler: none
38
+ - name: Update rubygems & bundler
39
+ run: gem update --system
40
+ - name: Install gems
41
+ run: |
42
+ bundle config set --local without libs:profilers
43
+ bundle install --jobs 4 --retry 3
44
+ - name: Install the WASI SDK
45
+ run: |
46
+ url="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_RELEASE}-x86_64-linux.tar.gz"
47
+ mkdir -p "$HOME/wasi-sdk"
48
+ curl -sSL "$url" | tar xz --strip-components=1 -C "$HOME/wasi-sdk"
49
+ echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> "$GITHUB_ENV"
50
+ - name: Install wasmtime
51
+ uses: bytecodealliance/actions/wasmtime/setup@v1
52
+ with:
53
+ version: ${{ env.WASMTIME_VERSION }}
54
+ - name: Build and smoke-test the WebAssembly module
55
+ run: bundle exec rake wasm:check
@@ -7,15 +7,18 @@ on:
7
7
  pull_request: {}
8
8
  merge_group: {}
9
9
 
10
+ permissions:
11
+ contents: read
12
+
10
13
  jobs:
11
14
  compile:
12
15
  runs-on: "windows-latest"
13
16
  strategy:
14
17
  fail-fast: false
15
18
  matrix:
16
- ruby: ['3.4', ucrt, mswin]
19
+ ruby: ['4.0', ucrt, mswin]
17
20
  steps:
18
- - uses: actions/checkout@v6
21
+ - uses: actions/checkout@v7
19
22
  - name: load ruby
20
23
  uses: ruby/setup-ruby@v1
21
24
  with:
@@ -35,6 +38,9 @@ jobs:
35
38
  bundled_gems = JSON.parse(res)["gems"].map{_1["gem"]}
36
39
  system "gem uninstall #{bundled_gems.join(" ")} --force", exception: true
37
40
  '
41
+ - name: Ignore Gemfile.lock's BUNDLED WITH on dev Ruby
42
+ if: ${{ matrix.ruby == 'ucrt' || matrix.ruby == 'mswin' }}
43
+ run: bundle config set --local version system
38
44
  - name: bundle install
39
45
  run: |
40
46
  bundle config set without profilers libs
data/.gitignore CHANGED
@@ -29,3 +29,11 @@ ext/rbs_extension/.cache
29
29
  # Rust crate vendored RBS source (managed by rake rust:rbs:sync or rust:rbs:symlink)
30
30
  rust/ruby-rbs-sys/vendor/rbs/
31
31
  rust/ruby-rbs/vendor/rbs/
32
+
33
+ # Compiled WebAssembly module (built by rake wasm:build)
34
+ wasm/*.wasm
35
+
36
+ # JRuby runtime artifact (built by rake wasm:jruby_setup, bundled in the -java
37
+ # gem). The require_jar file lib/rbs_jars.rb is committed; the Chicory/ASM jars
38
+ # themselves live in ~/.m2 (jar-dependencies), not here.
39
+ lib/rbs/wasm/*.wasm