Skip to content

Commit

Permalink
Migrate to magnus/rb_sys
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Nov 3, 2022
1 parent 36f34fe commit b0f5c03
Show file tree
Hide file tree
Showing 48 changed files with 2,190 additions and 456 deletions.
5 changes: 5 additions & 0 deletions .cross_rubies
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
3.1.0:x86_64-linux
3.1.0:aarch64-linux
3.1.0:x86_64-darwin
3.1.0:arm64-darwin
3.1.0:x64-mingw-ucrt
148 changes: 148 additions & 0 deletions .github/workflows/cruby-build-and-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Test cruby build and installation
concurrency:
group: "${{github.workflow}}-${{github.ref}}"
cancel-in-progress: true

on:
pull_request:

jobs:
cruby-package:
name: Compile native gem
runs-on: ubuntu-latest
strategy:
# fail-fast: false
matrix:
platform:
- x86_64-linux
- aarch64-linux

- x86_64-darwin
# github actions does not support this runner, which is why it's
# missing below
- arm64-darwin

- "x64-mingw-ucrt"

steps:
- uses: actions/checkout@v3

- uses: oxidize-rb/actions/setup-ruby-and-rust@main
with:
ruby-version: "3.1"
rubygems: latest
bundler-cache: false
cargo-cache: true
cargo-vendor: true

- uses: oxidize-rb/cross-gem-action@main
with:
ruby-versions: '3.1'
platform: ${{ matrix.platform }}
env: |
RUBY_CC_VERSION=3.1.0
- name: "Test gem build"
run: |
./script/test-gem-build gems ${{matrix.platform}}
- uses: actions/upload-artifact@v3
with:
name: "cruby-${{matrix.platform}}-gem"
path: gems
retention-days: 1

cruby-x86_64-linux-install:
needs: ["cruby-package"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: "${{matrix.ruby}}"

- uses: actions/download-artifact@v3
with:
name: cruby-x86_64-linux-gem
path: gems
- run: ./script/test-gem-install gems

cruby-aarch64-linux-install:
needs: ["cruby-package"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: "${{matrix.ruby}}"

- uses: actions/download-artifact@v3
with:
name: cruby-aarch64-linux-gem
path: gems

- run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -v "$(pwd):/commonmarker" -w /commonmarker \
--platform=linux/arm64/v8 \
ruby:${{matrix.ruby}} \
./script/test-gem-install gems
cruby-x86_64-darwin-install:
needs: ["cruby-package"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1"]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
rubygems: latest
ruby-version: "${{matrix.ruby}}"

- uses: actions/download-artifact@v3
with:
name: cruby-x86_64-darwin-gem
path: gems

- run: ./script/test-gem-install gems

# FIXME: does not seem to work
# cruby-x64-mingw-ucrt-install:
# needs: ["cruby-package"]
# strategy:
# fail-fast: false
# matrix:
# ruby: ["3.1"]
# runs-on: windows-latest
# steps:
# - uses: ruby/setup-ruby@v1

# with:
# ruby-version: "${{matrix.ruby}}"

# - uses: actions/download-artifact@v3
# with:
# name: cruby-x64-mingw-ucrt-gem
# path: gems

# - run: |
# gem update --system 3.3.22 --no-document
# gem install --verbose --no-document gems/*.gem
# gem list -d commonmarker
# bundle exec ruby -e 'require "commonmarker"; puts Commonmarker.to_html("Hello, _world_")'
91 changes: 91 additions & 0 deletions .github/workflows/generic-build-and-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Test generic build and installation
concurrency:
group: "${{github.workflow}}-${{github.ref}}"
cancel-in-progress: true

on:
pull_request:

jobs:
generic-package:
name: "generic-package"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: oxidize-rb/actions/setup-ruby-and-rust@main
with:
ruby-version: "3.1"
rubygems: latest
bundler-cache: false
cargo-cache: true
cargo-vendor: true

- uses: oxidize-rb/cross-gem-action@main
with:
platform: x86_64-linux
env: |
RUBY_CC_VERSION=3.1.0
- run: ./script/test-gem-build gems ruby

- uses: actions/upload-artifact@v3
with:
name: generic-gem
path: gems
retention-days: 1

generic-linux-install:
needs: ["generic-package"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby-pkgs@v1
with:
ruby-version: "3.1"

- uses: actions/download-artifact@v3
with:
name: generic-gem
path: gems
- run: ./script/test-gem-install gems

# FIXME: does not seem to work
# generic-darwin-install:
# needs: ["generic-package"]
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v3

# - uses: ruby/setup-ruby@v1
# with:
# ruby-version: "3.1"

# - uses: actions/download-artifact@v3
# with:
# name: generic-gem
# path: gems
# - run: ./script/test-gem-install gems

# FIXME: does not seem to work
# generic-windows-install-ucrt:
# needs: ["generic-package"]
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v3

# - uses: ruby/setup-ruby-pkgs@v1
# with:
# ruby-version: "3.1"

# - uses: actions/download-artifact@v3
# with:
# name: generic-gem
# path: gems
# - run: |
# gem update --system 3.3.22 --no-document
# gem install --verbose --no-document gems/*.gem
# gem list -d commonmarker
# bundle exec ruby -e 'require "commonmarker"; puts Commonmarker.to_html("Hello, _world_")'
28 changes: 21 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@ name: Linting

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main

jobs:
test:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
ruby-version: 3.1
rubygems: latest
bundler-cache: true # 'bundle install' and cache
- name: Rubocop
run: bundle exec rake rubocop

clippy_format:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Obtain Rust
run: rustup override set ${{ matrix.rust }}
- name: Check clippy
run: rustup component add clippy && cargo clippy
- name: Check formatting
run: rustup component add rustfmt && cargo fmt -- --check
34 changes: 13 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,33 @@
name: CI
name: Test

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
ruby-version: [3.1, 3.0]

runs-on: ${{ matrix.os }}
ruby:
- 3.1

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/checkout@v3

- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # 'bundle install' and cache

- name: Set Cargo triple
if: runner.os == 'Windows'
shell: bash
run: rustup default stable-x86_64-pc-windows-gnu
ruby-version: ${{ matrix.ruby }}
rubygems: latest
bundler-cache: true
cargo-cache: true
cache-version: v1

- name: Run ${{ matrix.os }} tests
shell: bash
run: script/cibuild
- name: Run Ruby tests
run: bundle exec rake compile test
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ tmp/
Gemfile.lock
*.log
ports/
target/
/gems/

## Specific to RubyMotion:
.dat*
Expand All @@ -38,9 +40,10 @@ build/
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Vagrant
/.vagrant/

actual.txt
test.txt
test/progit
test/benchinput.md

.vscode
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ inherit_gem:

AllCops:
Exclude:
- "pkg/**/*"
- "ext/**/*"
- "vendor/**/*"
- "tmp/**/*"
Expand Down
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"rust-lang.rust-analyzer",
"bungcip.better-toml",
"Shopify.ruby-lsp",
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rust-analyzer.checkOnSave.command": "clippy",
}
Loading

0 comments on commit b0f5c03

Please sign in to comment.