Skip to content

Commit

Permalink
Merge pull request #358 from ruby/katei/support-gem
Browse files Browse the repository at this point in the history
Support RubyGems / Bundler
  • Loading branch information
kateinoigakukun authored Jan 4, 2024
2 parents 81b72e3 + 7d551b0 commit c1be033
Show file tree
Hide file tree
Showing 70 changed files with 4,095 additions and 488 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ jobs:
entries: ${{ steps.set-matrix.outputs.entries }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- run: rake ci:pin_build_manifest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -112,18 +116,33 @@ jobs:
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- run: ./bin/setup
- name: Setup builder container
run: |
docker run -dit -v "$GITHUB_WORKSPACE:/home/me/build" -w /home/me/build \
-e "ENABLE_GITHUB_ACTIONS_MARKUP=true" \
-e "RUBYWASM_UID=$(id -u)" -e "RUBYWASM_GID=$(id -g)" \
-e "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" \
--name builder \
${{ steps.builder-image.outputs.imageid }} /bin/sh
echo 'docker exec -u me builder "$@"' > ./build-exec
chmod +x ./build-exec
- run: ./build-exec bundle config set --local without check
- run: ./build-exec ./bin/setup
- run: ./build-exec bundle exec rake compile
- name: Pre-release configuration
run: rake ${{ matrix.entry.prerelease }}[${{ inputs.prerel_name }}]
run: ./build-exec bundle exec rake ${{ matrix.entry.prerelease }}[${{ inputs.prerel_name }}]
if: ${{ inputs.prerel_name != '' && matrix.entry.prerelease != '' }}
- name: rake ${{ matrix.entry.task }}
run: docker run -v "$GITHUB_WORKSPACE:/home/me/build" -w /home/me/build -e "ENABLE_GITHUB_ACTIONS_MARKUP=true" -e "RUBYWASM_UID=$(id -u)" -e "RUBYWASM_GID=$(id -g)" -e "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" ${{ steps.builder-image.outputs.imageid }} rake --verbose ${{ matrix.entry.task }}
run: ./build-exec rake --verbose ${{ matrix.entry.task }}
- uses: ruby/setup-ruby@v1
if: ${{ matrix.entry.test != '' }}
with:
ruby-version: "3.2"
bundler-cache: false
- name: rake ${{ matrix.entry.test }}
run: rake ${{ matrix.entry.test }}
run: |
bundle install --with=check --without=development
rake ${{ matrix.entry.test }}
if: ${{ matrix.entry.test != '' }}
- uses: actions/upload-artifact@v4
if: ${{ matrix.entry.artifact }}
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ dist
/build
/rubies
/release
/tmp
/target
/Gemfile.lock
/lib/ruby_wasm/ruby_wasm.so

.cache
compile_commands.json

html

build_manifest.json

vendor/bundle
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ To select a build profile, see [profiles section in README](https://github.com/r

```console
# Build only a specific combination of ruby version, profile, and target
$ rake build:head-wasm32-unknown-wasi-full-js
$ rake build:head-wasm32-unknown-wasi-full
# Clean up the build directory
$ rake build:head-wasm32-unknown-wasi-full-js:clean
$ rake build:head-wasm32-unknown-wasi-full:clean
# Force to re-execute "make install"
$ rake build:head-wasm32-unknown-wasi-full-js:remake
$ rake build:head-wasm32-unknown-wasi-full:remake

# Output is in the `rubies` directory
$ tree -L 3 rubies/head-wasm32-unknown-wasi-full-js
Expand Down
Loading

0 comments on commit c1be033

Please sign in to comment.