rbs 4.0.3 → 4.1.1
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.
- checksums.yaml +4 -4
- data/.dockerignore +37 -0
- data/.github/dependabot.yml +1 -1
- data/.github/workflows/bundle-update.yml +2 -2
- data/.github/workflows/c-check.yml +14 -6
- data/.github/workflows/comments.yml +2 -2
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/jruby.yml +79 -0
- data/.github/workflows/release-gems.yml +164 -0
- data/.github/workflows/ruby.yml +43 -3
- data/.github/workflows/rust.yml +13 -10
- data/.github/workflows/truffleruby.yml +54 -0
- data/.github/workflows/typecheck.yml +5 -2
- data/.github/workflows/wasm.yml +55 -0
- data/.github/workflows/windows.yml +5 -2
- data/.gitignore +8 -0
- data/CHANGELOG.md +95 -4
- data/Dockerfile.jruby +53 -0
- data/README.md +3 -3
- data/Rakefile +429 -34
- data/Steepfile +9 -0
- data/config.yml +26 -0
- data/core/array.rbs +243 -180
- data/core/builtin.rbs +7 -6
- data/core/class.rbs +5 -3
- data/core/enumerable.rbs +109 -109
- data/core/enumerator/product.rbs +5 -5
- data/core/enumerator.rbs +28 -28
- data/core/file.rbs +24 -1018
- data/core/file_constants.rbs +463 -0
- data/core/file_stat.rbs +534 -0
- data/core/float.rbs +0 -24
- data/core/hash.rbs +117 -101
- data/core/integer.rbs +21 -58
- data/core/io.rbs +25 -7
- data/core/kernel.rbs +26 -11
- data/core/match_data.rbs +1 -1
- data/core/module.rbs +88 -74
- data/core/numeric.rbs +3 -0
- data/core/object_space/weak_key_map.rbs +7 -7
- data/core/pathname.rbs +0 -10
- data/core/ractor.rbs +0 -10
- data/core/range.rbs +23 -23
- data/core/rbs/ops.rbs +154 -0
- data/core/rbs/unnamed/argf.rbs +3 -3
- data/core/ruby_vm.rbs +40 -0
- data/core/rubygems/errors.rbs +4 -1
- data/core/rubygems/requirement.rbs +0 -10
- data/core/rubygems/rubygems.rbs +4 -1
- data/core/rubygems/specification.rbs +8 -0
- data/core/rubygems/version.rbs +0 -160
- data/core/set.rbs +3 -3
- data/core/struct.rbs +16 -16
- data/core/thread.rbs +9 -14
- data/docs/CONTRIBUTING.md +2 -1
- data/docs/inline.md +65 -7
- data/docs/rbs_by_example.md +20 -20
- data/docs/release.md +151 -0
- data/docs/syntax.md +2 -2
- data/docs/wasm_serialization.md +80 -0
- data/ext/rbs_extension/ast_translation.c +1298 -956
- data/ext/rbs_extension/ast_translation.h +4 -0
- data/ext/rbs_extension/class_constants.c +2 -0
- data/ext/rbs_extension/class_constants.h +1 -0
- data/ext/rbs_extension/extconf.rb +1 -0
- data/ext/rbs_extension/legacy_location.c +11 -6
- data/ext/rbs_extension/main.c +139 -4
- data/include/rbs/ast.h +323 -298
- data/include/rbs/defines.h +13 -0
- data/include/rbs/lexer.h +1 -0
- data/include/rbs/serialize.h +39 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +27 -31
- data/lib/rbs/ast/ruby/annotations.rb +42 -0
- data/lib/rbs/ast/ruby/comment_block.rb +6 -4
- data/lib/rbs/ast/ruby/declarations.rb +11 -1
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +1 -1
- data/lib/rbs/ast/ruby/members.rb +40 -1
- data/lib/rbs/buffer.rb +48 -11
- data/lib/rbs/cli.rb +3 -5
- data/lib/rbs/collection/config/lockfile_generator.rb +14 -1
- data/lib/rbs/collection/sources/git.rb +6 -0
- data/lib/rbs/definition_builder/method_builder.rb +12 -6
- data/lib/rbs/environment.rb +10 -3
- data/lib/rbs/inline_parser.rb +54 -28
- data/lib/rbs/namespace.rb +47 -11
- data/lib/rbs/parser_aux.rb +4 -2
- data/lib/rbs/prototype/rbi.rb +193 -25
- data/lib/rbs/prototype/runtime.rb +2 -0
- data/lib/rbs/resolver/type_name_resolver.rb +12 -14
- data/lib/rbs/rewriter.rb +70 -0
- data/lib/rbs/test/type_check.rb +6 -1
- data/lib/rbs/type_name.rb +33 -13
- data/lib/rbs/unit_test/type_assertions.rb +9 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/wasm/deserializer.rb +213 -0
- data/lib/rbs/wasm/location.rb +61 -0
- data/lib/rbs/wasm/parser.rb +137 -0
- data/lib/rbs/wasm/runtime.rb +196 -0
- data/lib/rbs/wasm/serialization_schema.rb +110 -0
- data/lib/rbs.rb +14 -2
- data/lib/rbs_jars.rb +39 -0
- data/lib/rdoc_plugin/parser.rb +5 -0
- data/rbs.gemspec +32 -2
- data/sig/annotate/rdoc_annotater.rbs +12 -9
- data/sig/ast/ruby/annotations.rbs +49 -0
- data/sig/ast/ruby/members.rbs +21 -1
- data/sig/buffer.rbs +19 -1
- data/sig/collection/config/lockfile_generator.rbs +2 -0
- data/sig/inline_parser.rbs +2 -0
- data/sig/manifest.yaml +0 -1
- data/sig/namespace.rbs +20 -0
- data/sig/parser.rbs +10 -0
- data/sig/prototype/rbi.rbs +33 -4
- data/sig/resolver/type_name_resolver.rbs +2 -4
- data/sig/rewriter.rbs +45 -0
- data/sig/typename.rbs +15 -0
- data/sig/unit_test/type_assertions.rbs +4 -0
- data/sig/wasm/deserializer.rbs +66 -0
- data/sig/wasm/serialization_schema.rbs +13 -0
- data/src/ast.c +186 -162
- data/src/lexer.c +220 -193
- data/src/lexer.re +2 -1
- data/src/lexstate.c +10 -1
- data/src/parser.c +61 -8
- data/src/serialize.c +958 -0
- data/src/util/rbs_allocator.c +14 -8
- data/stdlib/abbrev/0/array.rbs +1 -1
- data/stdlib/csv/0/csv.rbs +5 -5
- data/stdlib/delegate/0/delegator.rbs +2 -1
- data/stdlib/digest/0/digest.rbs +11 -5
- data/stdlib/erb/0/erb.rbs +1 -1
- data/stdlib/etc/0/etc.rbs +18 -4
- data/stdlib/fileutils/0/fileutils.rbs +21 -21
- data/stdlib/ipaddr/0/ipaddr.rbs +0 -5
- data/stdlib/json/0/json.rbs +6 -6
- data/stdlib/monitor/0/monitor.rbs +2 -2
- data/stdlib/openssl/0/openssl.rbs +46 -40
- data/stdlib/resolv/0/resolv.rbs +1 -1
- data/stdlib/shellwords/0/shellwords.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +32 -10
- data/stdlib/strscan/0/string_scanner.rbs +74 -55
- data/stdlib/tempfile/0/manifest.yaml +3 -0
- data/stdlib/timeout/0/timeout.rbs +0 -5
- data/stdlib/tsort/0/cyclic.rbs +1 -1
- data/stdlib/tsort/0/interfaces.rbs +8 -8
- data/stdlib/tsort/0/tsort.rbs +9 -9
- data/stdlib/uri/0/generic.rbs +0 -5
- data/stdlib/zlib/0/gzip_reader.rbs +2 -2
- data/stdlib/zlib/0/zstream.rbs +0 -1
- data/wasm/README.md +60 -0
- data/wasm/rbs_wasm.c +423 -0
- metadata +29 -6
- data/.github/workflows/milestone.yml +0 -80
- data/.vscode/extensions.json +0 -5
- data/.vscode/settings.json +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a0ae1797f25f4639914ed5244dd903aa9bf0cb28d8f7ad46917ea78a5a390c8b
|
|
4
|
+
data.tar.gz: 78456ce40939bc2911cf4b70a8053449f34a457fadc35eda478d6e7bec7cc527
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b27b18e6a70bf268ecb3db9de38954a733352d643504d1842f9c2dbc9aa4c3af7abf5b9816838a795082061ed3519384e764c31acbce208338cae636481b495a
|
|
7
|
+
data.tar.gz: fc7f3b804b4f93e18f71032ff34b19962100c5ca835628cf9d8e44467c96c683c699fb6fe8e0ec895a70c448bf1b21e9f840efd523e295378da9a6a5a42e340f
|
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/
|
data/.github/dependabot.yml
CHANGED
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
|
|
12
12
|
steps:
|
|
13
13
|
- name: Checkout repository
|
|
14
|
-
uses: actions/checkout@
|
|
14
|
+
uses: actions/checkout@v7
|
|
15
15
|
|
|
16
16
|
- name: Set up Ruby
|
|
17
17
|
uses: ruby/setup-ruby@v1
|
|
@@ -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 "
|
|
61
|
+
--label "skip-changelog"
|
|
62
62
|
|
|
63
63
|
gh pr merge --auto --merge "$(git rev-parse --abbrev-ref HEAD)"
|
|
@@ -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@
|
|
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
|
-
|
|
28
|
-
|
|
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.
|
|
39
|
-
tar xf re2c-4.
|
|
40
|
-
cd re2c-4.
|
|
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@
|
|
16
|
+
- uses: actions/checkout@v7
|
|
17
17
|
- uses: ruby/setup-ruby@v1
|
|
18
18
|
with:
|
|
19
|
-
ruby-version: "4.0.
|
|
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@
|
|
17
|
+
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
|
|
18
18
|
id: metadata
|
|
19
19
|
- name: Checkout repository
|
|
20
|
-
uses: actions/checkout@
|
|
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
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
name: Release gems
|
|
2
|
+
|
|
3
|
+
# Builds, publishes, and announces a release. Dispatch it against the `vX.Y.Z` tag
|
|
4
|
+
# of the release: the tag is created first so that everything published afterwards
|
|
5
|
+
# traces back to an immutable ref, and so the reversible step comes before the
|
|
6
|
+
# irreversible one.
|
|
7
|
+
#
|
|
8
|
+
# Dispatching against a branch builds and verifies the gems and stops there, which
|
|
9
|
+
# is how the build is exercised without releasing anything.
|
|
10
|
+
#
|
|
11
|
+
# | Gem | Platform | Parser |
|
|
12
|
+
# | -------------------- | ------------- | -------------------------------- |
|
|
13
|
+
# | `rbs-X.Y.Z.gem` | `ruby` (MRI) | C extension, compiled on install |
|
|
14
|
+
# | `rbs-X.Y.Z-java.gem` | `java` (JRuby)| `rbs_parser.wasm`, prebuilt here |
|
|
15
|
+
#
|
|
16
|
+
# See docs/release.md. The `java` gem is built on CRuby: the platform comes from
|
|
17
|
+
# `RBS_PLATFORM`, not from the engine running `gem build`. JRuby is only needed to
|
|
18
|
+
# run the result, which the workflow does before it would publish anything.
|
|
19
|
+
#
|
|
20
|
+
# One job on purpose. Tagging, pushing the gems, and opening the GitHub release
|
|
21
|
+
# all belong to a single release, and keeping them in one place keeps their order
|
|
22
|
+
# readable -- the tag is created before anything is published, so the reversible
|
|
23
|
+
# step comes before the irreversible one.
|
|
24
|
+
|
|
25
|
+
on:
|
|
26
|
+
workflow_dispatch:
|
|
27
|
+
|
|
28
|
+
permissions:
|
|
29
|
+
contents: read
|
|
30
|
+
|
|
31
|
+
env:
|
|
32
|
+
# Keep in sync with .github/workflows/wasm.yml and .github/workflows/jruby.yml.
|
|
33
|
+
WASI_SDK_VERSION: "33"
|
|
34
|
+
WASI_SDK_RELEASE: "33.0"
|
|
35
|
+
|
|
36
|
+
jobs:
|
|
37
|
+
release:
|
|
38
|
+
name: release
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
permissions:
|
|
41
|
+
contents: write # publish the GitHub release
|
|
42
|
+
id-token: write # trusted publishing to RubyGems
|
|
43
|
+
steps:
|
|
44
|
+
# The gemspec takes its file list from `git ls-files`, so both gems are built
|
|
45
|
+
# from the committed state.
|
|
46
|
+
- uses: actions/checkout@v7
|
|
47
|
+
- name: Set up Ruby
|
|
48
|
+
uses: ruby/setup-ruby@v1
|
|
49
|
+
with:
|
|
50
|
+
ruby-version: ruby
|
|
51
|
+
bundler: none
|
|
52
|
+
- name: Update rubygems & bundler
|
|
53
|
+
run: gem update --system
|
|
54
|
+
- name: Install gems
|
|
55
|
+
run: |
|
|
56
|
+
bundle config set --local without libs:profilers
|
|
57
|
+
bundle install --jobs 4 --retry 3
|
|
58
|
+
|
|
59
|
+
- name: Read the version
|
|
60
|
+
id: version
|
|
61
|
+
run: echo "version=$(ruby -e 'load "lib/rbs/version.rb"; print RBS::VERSION')" >> "$GITHUB_OUTPUT"
|
|
62
|
+
|
|
63
|
+
# Fail before spending a minute on the build, and before anything is pushed:
|
|
64
|
+
# the tag is what the release is named after, so it has to be the version the
|
|
65
|
+
# tagged commit actually declares.
|
|
66
|
+
- name: Check the tag against RBS::VERSION
|
|
67
|
+
if: github.ref_type == 'tag'
|
|
68
|
+
run: |
|
|
69
|
+
if [ "${{ github.ref_name }}" != "v${{ steps.version.outputs.version }}" ]; then
|
|
70
|
+
echo "::error::tag ${{ github.ref_name }} does not match RBS::VERSION ${{ steps.version.outputs.version }}"
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
- name: Build the ruby gem
|
|
75
|
+
run: |
|
|
76
|
+
mkdir -p pkg
|
|
77
|
+
gem build rbs.gemspec -o "pkg/rbs-${{ steps.version.outputs.version }}.gem"
|
|
78
|
+
|
|
79
|
+
# `rake wasm:jruby_setup` compiles src/**/*.c to WebAssembly and copies the
|
|
80
|
+
# result to lib/rbs/wasm/, where the gemspec picks it up. clang runs as a
|
|
81
|
+
# subprocess, so this works on CRuby.
|
|
82
|
+
- name: Install the WASI SDK
|
|
83
|
+
run: |
|
|
84
|
+
url="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_RELEASE}-x86_64-linux.tar.gz"
|
|
85
|
+
mkdir -p "$HOME/wasi-sdk"
|
|
86
|
+
curl -sSL "$url" | tar xz --strip-components=1 -C "$HOME/wasi-sdk"
|
|
87
|
+
echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> "$GITHUB_ENV"
|
|
88
|
+
- name: Build rbs_parser.wasm
|
|
89
|
+
run: bundle exec rake wasm:jruby_setup
|
|
90
|
+
|
|
91
|
+
- name: Build the java gem
|
|
92
|
+
env:
|
|
93
|
+
RBS_PLATFORM: java
|
|
94
|
+
run: gem build rbs.gemspec -o "pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
|
|
95
|
+
|
|
96
|
+
# `git ls-files` vouches for everything else, but rbs_parser.wasm is a build
|
|
97
|
+
# artifact, so the java gem is the one that can come out quietly wrong.
|
|
98
|
+
- name: Check the built gems
|
|
99
|
+
run: |
|
|
100
|
+
ruby -rrubygems/package -e '
|
|
101
|
+
ruby_gem, java_gem = ARGV.map { Gem::Package.new(_1).spec }
|
|
102
|
+
|
|
103
|
+
raise "unexpected platform: #{ruby_gem.platform}" unless ruby_gem.platform.to_s == "ruby"
|
|
104
|
+
raise "the C extension is not declared" if ruby_gem.extensions.empty?
|
|
105
|
+
|
|
106
|
+
raise "unexpected platform: #{java_gem.platform}" unless java_gem.platform.to_s == "java"
|
|
107
|
+
raise "rbs_parser.wasm is missing" unless java_gem.files.include?("lib/rbs/wasm/rbs_parser.wasm")
|
|
108
|
+
raise "the java gem must not declare an extension" unless java_gem.extensions.empty?
|
|
109
|
+
|
|
110
|
+
[ruby_gem, java_gem].each { puts "#{_1.full_name}: #{_1.files.size} files" }
|
|
111
|
+
' "pkg/rbs-${{ steps.version.outputs.version }}.gem" \
|
|
112
|
+
"pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
|
|
113
|
+
|
|
114
|
+
# The checks above cannot tell whether rbs_parser.wasm actually runs. Install
|
|
115
|
+
# the gem the way a user would -- jar-dependencies fetches Chicory and ASM
|
|
116
|
+
# from Maven during the install -- and parse something with it, so the
|
|
117
|
+
# WebAssembly runtime is exercised end to end before anything is published.
|
|
118
|
+
- name: Set up JRuby
|
|
119
|
+
uses: ruby/setup-ruby@v1
|
|
120
|
+
with:
|
|
121
|
+
ruby-version: jruby
|
|
122
|
+
bundler: none
|
|
123
|
+
- name: Check the java gem on JRuby
|
|
124
|
+
run: |
|
|
125
|
+
gem install "pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
|
|
126
|
+
ruby -e '
|
|
127
|
+
require "rbs"
|
|
128
|
+
_, _, decls = RBS::Parser.parse_signature("class Foo end")
|
|
129
|
+
names = decls.map { _1.name.to_s }
|
|
130
|
+
raise "parsed #{names.inspect}, expected [\"Foo\"]" unless names == ["Foo"]
|
|
131
|
+
puts "#{RUBY_ENGINE} #{RUBY_VERSION}: rbs #{RBS::VERSION} parses through the WebAssembly runtime"
|
|
132
|
+
'
|
|
133
|
+
|
|
134
|
+
- name: Switch back to CRuby
|
|
135
|
+
uses: ruby/setup-ruby@v1
|
|
136
|
+
with:
|
|
137
|
+
ruby-version: ruby
|
|
138
|
+
bundler: none
|
|
139
|
+
|
|
140
|
+
# Uploaded before publishing, so a failed push still leaves the gems behind.
|
|
141
|
+
- uses: actions/upload-artifact@v7
|
|
142
|
+
with:
|
|
143
|
+
name: gems
|
|
144
|
+
path: pkg/*.gem
|
|
145
|
+
if-no-files-found: error
|
|
146
|
+
|
|
147
|
+
# Everything below runs only for a release tag.
|
|
148
|
+
- name: Configure RubyGems credentials
|
|
149
|
+
if: github.ref_type == 'tag'
|
|
150
|
+
# No floating major tag on this action, so the exact release is pinned.
|
|
151
|
+
uses: rubygems/configure-rubygems-credentials@v2.1.0
|
|
152
|
+
|
|
153
|
+
- name: Push the gems
|
|
154
|
+
if: github.ref_type == 'tag'
|
|
155
|
+
run: |
|
|
156
|
+
gem push "pkg/rbs-${{ steps.version.outputs.version }}.gem"
|
|
157
|
+
gem push "pkg/rbs-${{ steps.version.outputs.version }}-java.gem"
|
|
158
|
+
|
|
159
|
+
# Last, so that a failed push never announces a release that has no gems.
|
|
160
|
+
- name: Publish the GitHub release
|
|
161
|
+
if: github.ref_type == 'tag'
|
|
162
|
+
env:
|
|
163
|
+
GH_TOKEN: ${{ github.token }}
|
|
164
|
+
run: bundle exec rake gem:gh_release
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -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.
|
|
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@
|
|
43
|
+
- uses: actions/checkout@v7
|
|
41
44
|
- uses: ruby/setup-ruby@v1
|
|
42
45
|
with:
|
|
43
46
|
ruby-version: ${{ matrix.ruby }}
|
|
@@ -87,7 +90,7 @@ jobs:
|
|
|
87
90
|
matrix:
|
|
88
91
|
ruby: ['4.0', head]
|
|
89
92
|
steps:
|
|
90
|
-
- uses: actions/checkout@
|
|
93
|
+
- uses: actions/checkout@v7
|
|
91
94
|
- name: Install dependencies
|
|
92
95
|
run: |
|
|
93
96
|
brew install ruby-build
|
|
@@ -116,3 +119,40 @@ jobs:
|
|
|
116
119
|
run: |
|
|
117
120
|
bin/setup
|
|
118
121
|
- run: bundle exec rake clean compile_c99
|
|
122
|
+
|
|
123
|
+
clang_compile:
|
|
124
|
+
runs-on: macos-latest
|
|
125
|
+
strategy:
|
|
126
|
+
fail-fast: false
|
|
127
|
+
matrix:
|
|
128
|
+
ruby: ['4.0', head]
|
|
129
|
+
steps:
|
|
130
|
+
- uses: actions/checkout@v7
|
|
131
|
+
- name: Install dependencies
|
|
132
|
+
run: |
|
|
133
|
+
brew install ruby-build
|
|
134
|
+
- uses: ruby/setup-ruby@v1
|
|
135
|
+
with:
|
|
136
|
+
ruby-version: ${{ matrix.ruby }}
|
|
137
|
+
bundler: none
|
|
138
|
+
- name: Set working directory as safe
|
|
139
|
+
run: git config --global --add safe.directory $(pwd)
|
|
140
|
+
- name: Update rubygems & bundler
|
|
141
|
+
run: |
|
|
142
|
+
ruby -v
|
|
143
|
+
gem update --system
|
|
144
|
+
- name: install erb
|
|
145
|
+
run: gem install erb
|
|
146
|
+
- name: clang version
|
|
147
|
+
run: clang --version
|
|
148
|
+
- name: bundle config set force_ruby_platform true if head
|
|
149
|
+
if: ${{ contains(matrix.ruby, 'head') }}
|
|
150
|
+
run: |
|
|
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
|
|
155
|
+
- name: bin/setup
|
|
156
|
+
run: |
|
|
157
|
+
bin/setup
|
|
158
|
+
- run: bundle exec rake clean compile
|
data/.github/workflows/rust.yml
CHANGED
|
@@ -8,12 +8,15 @@ on:
|
|
|
8
8
|
paths:
|
|
9
9
|
- ".github/workflows/rust.yml"
|
|
10
10
|
- "rust/**"
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
# `merge_group` has no `paths` filter, so this runs on every queue entry.
|
|
12
|
+
merge_group: {}
|
|
13
13
|
|
|
14
14
|
env:
|
|
15
15
|
RUSTFLAGS: "-D warnings"
|
|
16
16
|
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
17
20
|
jobs:
|
|
18
21
|
test:
|
|
19
22
|
name: cargo:test
|
|
@@ -23,7 +26,7 @@ jobs:
|
|
|
23
26
|
matrix:
|
|
24
27
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
25
28
|
steps:
|
|
26
|
-
- uses: actions/checkout@
|
|
29
|
+
- uses: actions/checkout@v7
|
|
27
30
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
28
31
|
- name: Set up Ruby
|
|
29
32
|
uses: ruby/setup-ruby@v1
|
|
@@ -42,7 +45,7 @@ jobs:
|
|
|
42
45
|
run: |
|
|
43
46
|
rustup update --no-self-update stable
|
|
44
47
|
rustup default stable
|
|
45
|
-
- uses: actions/cache@
|
|
48
|
+
- uses: actions/cache@v6
|
|
46
49
|
with:
|
|
47
50
|
path: |
|
|
48
51
|
~/.cargo/registry
|
|
@@ -61,7 +64,7 @@ jobs:
|
|
|
61
64
|
runs-on: ubuntu-latest
|
|
62
65
|
continue-on-error: true
|
|
63
66
|
steps:
|
|
64
|
-
- uses: actions/checkout@
|
|
67
|
+
- uses: actions/checkout@v7
|
|
65
68
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
66
69
|
- name: Set up git identity
|
|
67
70
|
run: |
|
|
@@ -84,7 +87,7 @@ jobs:
|
|
|
84
87
|
run: |
|
|
85
88
|
rustup update --no-self-update stable
|
|
86
89
|
rustup default stable
|
|
87
|
-
- uses: actions/cache@
|
|
90
|
+
- uses: actions/cache@v6
|
|
88
91
|
with:
|
|
89
92
|
path: |
|
|
90
93
|
~/.cargo/registry
|
|
@@ -103,7 +106,7 @@ jobs:
|
|
|
103
106
|
runs-on: ubuntu-latest
|
|
104
107
|
continue-on-error: true
|
|
105
108
|
steps:
|
|
106
|
-
- uses: actions/checkout@
|
|
109
|
+
- uses: actions/checkout@v7
|
|
107
110
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
108
111
|
- name: Set up git identity
|
|
109
112
|
run: |
|
|
@@ -126,7 +129,7 @@ jobs:
|
|
|
126
129
|
run: |
|
|
127
130
|
rustup update --no-self-update stable
|
|
128
131
|
rustup default stable
|
|
129
|
-
- uses: actions/cache@
|
|
132
|
+
- uses: actions/cache@v6
|
|
130
133
|
with:
|
|
131
134
|
path: |
|
|
132
135
|
~/.cargo/registry
|
|
@@ -144,7 +147,7 @@ jobs:
|
|
|
144
147
|
name: cargo:lint
|
|
145
148
|
runs-on: ubuntu-latest
|
|
146
149
|
steps:
|
|
147
|
-
- uses: actions/checkout@
|
|
150
|
+
- uses: actions/checkout@v7
|
|
148
151
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
149
152
|
- name: Set up Ruby
|
|
150
153
|
uses: ruby/setup-ruby@v1
|
|
@@ -164,7 +167,7 @@ jobs:
|
|
|
164
167
|
rustup update --no-self-update stable
|
|
165
168
|
rustup default stable
|
|
166
169
|
rustup component add --toolchain stable clippy rustfmt
|
|
167
|
-
- uses: actions/cache@
|
|
170
|
+
- uses: actions/cache@v6
|
|
168
171
|
with:
|
|
169
172
|
path: |
|
|
170
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@
|
|
19
|
+
- uses: actions/checkout@v7
|
|
17
20
|
- uses: ruby/setup-ruby@v1
|
|
18
21
|
with:
|
|
19
|
-
ruby-version: "
|
|
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)
|