name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build:
name: Build — ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux x86_64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
artifact: cvxtract-linux-x86_64
binary: cvxtract
- name: Linux aarch64
os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
artifact: cvxtract-linux-aarch64
binary: cvxtract
- name: macOS x86_64
os: macos-14
target: x86_64-apple-darwin
artifact: cvxtract-macos-x86_64
binary: cvxtract
- name: macOS Apple Silicon
os: macos-14
target: aarch64-apple-darwin
artifact: cvxtract-macos-aarch64
binary: cvxtract
features: metal
- name: Windows x86_64
os: windows-2022
target: x86_64-pc-windows-msvc
artifact: cvxtract-windows-x86_64
binary: cvxtract.exe
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y cmake build-essential libssl-dev pkg-config
- name: Install macOS build dependencies
if: runner.os == 'macOS'
run: brew install cmake
- name: Install Windows build dependencies
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Build (native, no extra features)
if: "!matrix.features"
env:
COPILOT_TOKEN: ${{ secrets.COPILOT_TOKEN }}
run: cargo build --release --target ${{ matrix.target }} --bin cvxtract
- name: Build (native, with features)
if: "matrix.features"
env:
COPILOT_TOKEN: ${{ secrets.COPILOT_TOKEN }}
run: cargo build --release --target ${{ matrix.target }} --bin cvxtract --features ${{ matrix.features }}
- name: Package (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/${{ matrix.binary }} dist/
for f in README.md LICENSE-MIT; do
[ -f "$f" ] && cp "$f" dist/ || true
done
tar -czf ${{ matrix.artifact }}.tar.gz -C dist .
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force dist | Out-Null
Copy-Item "target\${{ matrix.target }}\release\${{ matrix.binary }}" dist\
Copy-Item README.md, LICENSE-MIT dist\
Compress-Archive -Path dist\* -DestinationPath "${{ matrix.artifact }}.zip"
- name: Upload release asset (tar.gz)
if: runner.os != 'Windows'
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.artifact }}.tar.gz
- name: Upload release asset (zip)
if: runner.os == 'Windows'
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.artifact }}.zip