Skip to content

Add aarch64-linux support, remove x86_64-darwin #11

Add aarch64-linux support, remove x86_64-darwin

Add aarch64-linux support, remove x86_64-darwin #11

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-native:
name: Build (${{ matrix.ruby-platform }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
ruby-platform: x86_64-linux
rust-target: x86_64-unknown-linux-gnu
- os: ubuntu-24.04-arm
ruby-platform: aarch64-linux
rust-target: aarch64-unknown-linux-gnu
- os: macos-15
ruby-platform: arm64-darwin
rust-target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-target }}
- name: Install cross
if: matrix.use-cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build CLI binary
run: cargo build --release -p methodray-core --features cli --bin methodray
- name: Build FFI extension
run: cargo build --release -p methodray --lib
- name: Copy binaries to lib directory
run: |
mkdir -p lib/methodray
# Debug: List build outputs
echo "=== Checking target/release/ ==="
ls -la target/release/ || echo "target/release/ does not exist"
# Copy CLI binary (from methodray-core package)
if [[ "${{ matrix.rust-target }}" == *"windows"* ]]; then
cp target/release/methodray.exe lib/methodray/methodray-cli.exe
else
cp target/release/methodray lib/methodray/methodray-cli
fi
chmod 755 lib/methodray/methodray-cli* || true
# Copy FFI extension (from methodray package in ext/)
case "${{ matrix.ruby-platform }}" in
*-darwin)
cp target/release/libmethodray.dylib lib/methodray/methodray.bundle
;;
*-linux)
cp target/release/libmethodray.so lib/methodray/methodray.so
;;
esac
ls -la lib/methodray/
- name: Build platform gem
run: |
# Create platform-specific gemspec
cat > methodray-${{ matrix.ruby-platform }}.gemspec << 'EOF'
require_relative 'lib/methodray/version'
Gem::Specification.new do |spec|
spec.name = 'method-ray'
spec.version = MethodRay::VERSION
spec.platform = '${{ matrix.ruby-platform }}'
spec.authors = ['dak2']
spec.email = ['dak2.dev@gmail.com']
spec.summary = 'Method-Ray is a fast static analysis tool for Ruby methods.'
spec.description = 'A static analysis tool that checks the callability of methods in Ruby code.'
spec.homepage = 'https://github.com/dak2/method-ray'
spec.license = 'MIT'
spec.required_ruby_version = '>= 3.4.0'
spec.files = Dir['lib/**/*', 'exe/*', 'README.md', 'LICENSE', 'CHANGELOG.md']
spec.bindir = 'exe'
spec.executables = ['methodray']
spec.require_paths = ['lib']
spec.add_dependency 'rbs', '~> 3.0'
end
EOF
gem build methodray-${{ matrix.ruby-platform }}.gemspec
mkdir -p pkg
mv *.gem pkg/
- name: Upload gem artifact
uses: actions/upload-artifact@v6
with:
name: gem-${{ matrix.ruby-platform }}
path: pkg/*.gem
build-source:
name: Build source gem
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- name: Build source gem
run: |
gem build methodray.gemspec
mkdir -p pkg
mv *.gem pkg/
- name: Upload gem artifact
uses: actions/upload-artifact@v6
with:
name: gem-source
path: pkg/*.gem
release:
name: Release
needs: [build-native, build-source]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
path: artifacts
- name: Collect all gems
run: |
mkdir -p release
find artifacts -name "*.gem" -exec cp {} release/ \;
ls -la release/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to RubyGems
env:
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
run: |
for gem in release/*.gem; do
echo "Pushing $gem..."
gem push "$gem"
done