Skip to content

macos test fix.

macos test fix. #23

Workflow file for this run

name: Rust Release
on:
push:
tags:
- "v*" # Runs when pushing a tag like v0.1.0
permissions:
contents: write # Required to create releases
jobs:
build:
name: Build Rust Binaries on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Run Tests
run: cargo test --verbose
- name: Build Binary
run: |
if [[ "$RUNNER_OS" == "macOS" ]]; then
if [[ "$(uname -m)" == "arm64" ]]; then
cargo build --release --target=aarch64-apple-darwin
else
cargo build --release --target=x86_64-apple-darwin
fi
elif [[ "$RUNNER_OS" == "Linux" ]]; then
rustup target add x86_64-unknown-linux-musl
cargo build --release --target=x86_64-unknown-linux-musl
else
echo "Unsupported platform"
exit 1
fi
- name: Rename Binary for OS
shell: bash
run: |
mkdir -p artifacts
if [[ "$RUNNER_OS" == "Linux" ]]; then
mv target/release/reqflow artifacts/reqflow-linux
elif [[ "$RUNNER_OS" == "macOS" ]]; then
if [[ "$(uname -m)" == "arm64" ]]; then
mv target/aarch64-apple-darwin/release/reqflow artifacts/reqflow-macos-arm64
else
mv target/x86_64-apple-darwin/release/reqflow artifacts/reqflow-macos-x86_64
fi
elif [[ "$RUNNER_OS" == "Windows" ]]; then
mv target/release/reqflow.exe artifacts/reqflow-windows.exe
fi
- name: Debug List Built Binaries
run: ls -R artifacts # Verify that files exist before upload
- name: Upload Built Binaries as Artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}
path: artifacts/*
release:
name: Create GitHub Release and Upload Binaries
needs: build # Runs after all builds finish
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download All Built Binaries
uses: actions/download-artifact@v4
with:
pattern: binaries-* # Match all OS binaries
path: artifacts
- name: Debug List Downloaded Binaries
run: ls -R artifacts # Debugging step to verify files exist
- name: Create GitHub Release and Upload Binaries
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: "Release ${{ github.ref_name }}"
body: "Automated release of ${{ github.ref_name }}"
draft: false
prerelease: false
files: artifacts/binaries-*/* # Match all OS binaries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}