bug fixes #97
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Ruby Release | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| dry_run: | ||
| description: "Dry run (build only, do not publish)" | ||
| required: false | ||
| type: boolean | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: true | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: "3.3" | ||
| bundler-cache: true | ||
| - name: Verify submodule checkout | ||
| run: | | ||
| set -euo pipefail | ||
| git submodule status --recursive | ||
| for path in submodules/mlx submodules/mlx-onnx submodules/mlx-ruby-examples; do | ||
| git submodule status -- "$path" >/dev/null | ||
| done | ||
| - name: Set Ruby crash report path | ||
| run: echo "RUBY_CRASH_REPORT=${RUNNER_TEMP}/ruby-crash-report.log" >> "$GITHUB_ENV" | ||
| - name: Install build tools | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential cmake libopenblas-dev liblapacke-dev | ||
| - name: Build native extension | ||
| run: | | ||
| cd ext/mlx | ||
| ruby extconf.rb | ||
| make -j2 | ||
| - name: Install dependencies | ||
| run: bundle install | ||
| - name: Run test suite | ||
| env: | ||
| RUBYOPT: -W:deprecated -W:performance | ||
| run: bundle exec rake test:all | ||
| - name: Show Ruby crash report (if present) | ||
| if: always() | ||
| run: | | ||
| if [ -f "${RUBY_CRASH_REPORT}" ]; then | ||
| echo "::group::Ruby crash report" | ||
| cat "${RUBY_CRASH_REPORT}" | ||
| echo "::endgroup::" | ||
| else | ||
| echo "No Ruby crash report emitted." | ||
| fi | ||
| - name: Build gem | ||
| run: gem build mlx.gemspec | ||
| - name: Upload gem artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mlx-gem | ||
| path: mlx-*.gem | ||
| if-no-files-found: error | ||
| publish: | ||
| if: ${{ !inputs.dry_run }} | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: mlx-gem | ||
| path: pkg | ||
| - name: Push to RubyGems | ||
| if: secrets.RUBYGEMS_API_KEY != '' | ||
| env: | ||
| RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p ~/.gem | ||
| cat > ~/.gem/credentials <<EOF | ||
| --- | ||
| :rubygems_api_key: ${RUBYGEMS_API_KEY} | ||
| EOF | ||
| chmod 0600 ~/.gem/credentials | ||
| gem push pkg/mlx-*.gem --key rubygems --host https://rubygems.org | ||