Skip to content

Merge pull request #2930 from ruby/version-4.1.0.pre.1 #202

Merge pull request #2930 from ruby/version-4.1.0.pre.1

Merge pull request #2930 from ruby/version-4.1.0.pre.1 #202

Workflow file for this run

name: Rust
on:
push:
branches:
- master
pull_request:
paths:
- ".github/workflows/rust.yml"
- "rust/**"
env:
RUSTFLAGS: "-D warnings"
jobs:
test:
name: cargo:test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler: none
- name: Update rubygems & bundler
run: gem update --system
- name: Install gems
run: |
bundle config set --local without libs:profilers
bundle install --jobs 4 --retry 3
- name: Set up vendored RBS source
run: bundle exec rake rust:rbs:sync
- name: Install Rust tools
run: |
rustup update --no-self-update stable
rustup default stable
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Run tests
run: |
cd rust
cargo test --verbose
publish-dry-run-ruby-rbs-sys:
name: rust:publish:ruby-rbs-sys
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v6
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up git identity
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler: none
- name: Update rubygems & bundler
run: gem update --system
- name: Install gems
run: |
bundle config set --local without libs:profilers
bundle install --jobs 4 --retry 3
- name: Set up vendored RBS source
run: bundle exec rake rust:rbs:sync
- name: Install Rust tools
run: |
rustup update --no-self-update stable
rustup default stable
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Test publish ruby-rbs-sys
run: bundle exec rake rust:publish:ruby-rbs-sys
env:
RBS_RUST_PUBLISH_DRY_RUN: "1"
publish-dry-run-ruby-rbs:
name: rust:publish:ruby-rbs
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v6
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up git identity
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler: none
- name: Update rubygems & bundler
run: gem update --system
- name: Install gems
run: |
bundle config set --local without libs:profilers
bundle install --jobs 4 --retry 3
- name: Set up vendored RBS source
run: bundle exec rake rust:rbs:sync
- name: Install Rust tools
run: |
rustup update --no-self-update stable
rustup default stable
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Test publish ruby-rbs
run: bundle exec rake rust:publish:ruby-rbs
env:
RBS_RUST_PUBLISH_DRY_RUN: "1"
lint:
name: cargo:lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler: none
- name: Update rubygems & bundler
run: gem update --system
- name: Install gems
run: |
bundle config set --local without libs:profilers
bundle install --jobs 4 --retry 3
- name: Set up vendored RBS source
run: bundle exec rake rust:rbs:sync
- name: Install Rust tools
run: |
rustup update --no-self-update stable
rustup default stable
rustup component add --toolchain stable clippy rustfmt
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: |
cd rust
cargo fmt --check
- name: Run clippy
run: |
cd rust
cargo clippy