-
Notifications
You must be signed in to change notification settings - Fork 4
96 lines (91 loc) · 2.67 KB
/
Copy pathrelease.yml
File metadata and controls
96 lines (91 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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: Smoke test packaged gem install and load
env:
TEST: test/gem/gem_test.rb
run: bundle exec rake test:gem
- 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