Skip to content

ci: fix arm64-musl cross-compilation by specifying explicit linker #4

ci: fix arm64-musl cross-compilation by specifying explicit linker

ci: fix arm64-musl cross-compilation by specifying explicit linker #4

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch: # Enable manual triggering from Actions tab
jobs:
build:
name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: write # Needed to create a release and upload assets
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
asset_name: fbqueue-linux-x64.tar.gz
example_dir: linux
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
asset_name: fbqueue-linux-arm64.tar.gz
example_dir: linux
- os: windows-latest
target: x86_64-pc-windows-msvc
asset_name: fbqueue-windows-x64.zip
example_dir: windows
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup target add ${{ matrix.target }}
- name: Install MUSL and Cross-compilers (Linux only)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y musl-tools gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: x86_64-linux-gnu-gcc
- name: Package (Linux)
if: runner.os == 'Linux'
run: |
mkdir -p dist/fbqueue
cp target/${{ matrix.target }}/release/fbqueue dist/fbqueue/
cp README.md MANUAL.md PBS_COMPATIBILITY.md dist/fbqueue/
cp -r examples/${{ matrix.example_dir }} dist/fbqueue/examples
cd dist
tar -czvf ${{ matrix.asset_name }} fbqueue
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Path dist\fbqueue
Copy-Item "target\${{ matrix.target }}\release\fbqueue.exe" -Destination dist\fbqueue\
Copy-Item "README.md", "MANUAL.md" -Destination dist\fbqueue\
Copy-Item -Path "examples\windows" -Destination dist\fbqueue\examples -Recurse
cd dist
Compress-Archive -Path "fbqueue" -DestinationPath "${{ matrix.asset_name }}"
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/${{ matrix.asset_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}