Skip to content

[Rust][Ruby] Add methods to get metadata for features #51

[Rust][Ruby] Add methods to get metadata for features

[Rust][Ruby] Add methods to get metadata for features #51

Workflow file for this run

name: "Build & Test"
on:
push:
branches: [ "main" ]
paths:
- ".github/workflows/build_test.yml"
- "python/**"
- "ruby/**"
- "rust/**"
- "tests/**"
pull_request:
branches: [ "main" ]
paths:
- ".github/workflows/build_test.yml"
- "python/**"
- "ruby/**"
- "rust/**"
- "tests/**"
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RB_SYS_CARGO_PROFILE: release
RB_SYS_CROSS_COMPILE: true
jobs:
test:
name: "Build & Test"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v4
# Rust
- name: "[Rust] Build"
run: cargo build --release
working-directory: ./rust/optify
- name: "[Rust] Lint"
run : cargo fmt -- --check
working-directory: ./rust/optify
- name: "[Rust] Clippy"
run: cargo clippy --release --no-deps -- -D warnings --no-deps
working-directory: ./rust/optify
- name: "[Rust] Test"
run: cargo test --release
working-directory: ./rust/optify
- name: "[Rust] Publish"
if: github.ref == 'refs/heads/main'
shell: bash
# It probably just fails if the crate is already published.
# We want to only be lenient for the `cargo publish`, but we would still want to clearly see that an issue happened during the run.
continue-on-error: true
run: |
cargo publish --token ${CARGO_REGISTRY_TOKEN}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
working-directory: ./rust/optify
# Ruby
# setup-ruby also runs `bundle install`.
# It uses the Ruby version from .ruby-version.
- uses: ruby/setup-ruby@v1
name: "[Ruby] Setup"
with:
bundler-cache: true
working-directory: ./ruby/optify
- name: "[Ruby] Lint"
shell: bash
run: |
set -ex
bundle exec srb tc
bundle exec rubocop
# Ensure that the RBS file is up-to-date.
mkdir -p tmp
bundle exec rbs prototype rbi rbi/optify.rbi > tmp/optify.rbs~
diff -u sig/optify.rbs tmp/optify.rbs~
working-directory: ./ruby/optify
- name: "[Ruby][Rust] Lint"
run : cargo fmt -- --check
working-directory: ./ruby/optify
- name: "[Ruby][Rust] Clippy"
run: cargo clippy --release --no-deps -- -D warnings --no-deps
working-directory: ./ruby/optify
- name: "[Ruby] Test"
run: bundle exec rake test
working-directory: ./ruby/optify
# Python
- uses: actions/setup-python@v5
name: "[Python] Setup"
with:
cache: pip
python-version: 3.x
- name: "[Python] Build"
shell: bash
run: pip install -e .[dev]
working-directory: ./python/optify
- name: "[Python][Rust] Lint"
run : cargo fmt -- --check
working-directory: ./python/optify
- name: "[Python][Rust] Clippy"
run: cargo clippy --release --no-deps -- -D warnings --no-deps
working-directory: ./python/optify
- name: "[Python] Test"
shell: bash
run: pytest
working-directory: ./python/optify