Skip to content

windows ARM workflow (#12) #57

windows ARM workflow (#12)

windows ARM workflow (#12) #57

Workflow file for this run

name: Build Zenyx ⚡
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
# Credit to https://github.com/Far-Beyond-Dev/Horizon/blob/main/.github/workflows/main.yml
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get binary name
id: binary
run: |
BINARY_NAME=$(cargo metadata --format-version 1 | jq -r '.packages[0].targets[] | select(.kind[] | contains("bin")) | .name')
echo "name=$BINARY_NAME" >> "$GITHUB_OUTPUT"
- name: Check version change
id: version
run: |
git fetch
OLD_VERSION=$(git show HEAD^:Cargo.toml | grep -m 1 '^version = ' | cut -d '"' -f 2)
NEW_VERSION=$(grep -m 1 '^version = ' Cargo.toml | cut -d '"' -f 2)
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
fi
- name: Create Release
if: steps.version.outputs.changed == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release v${{ steps.version.outputs.version }}
files: target/release/${{ steps.binary.outputs.name }}
generate_release_notes: true
draft: false
prerelease: false
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x86_64, aarch64]
include:
- arch: x86_64
target: x86_64-unknown-linux-gnu
- os: macos-latest
arch: x86_64
target: x86_64-apple-darwin
- arch: aarch64
target: aarch64-unknown-linux-gnu
- os: macos-latest
arch: aarch64
target: aarch64-apple-darwin
- os: windows-latest
arch: x86_64
target: x86_64-pc-windows-msvc
- os: windows-latest
arch: aarch64
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Clone repository
uses: actions/checkout@v3
- name: 🛠️ Install cross-compilation dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user
- name: 🛠️ Install cross-compilation dependencies (macOS🍎)
if: runner.os == 'macOS'
run: |
brew install FiloSottile/musl-cross/musl-cross
- name: 🔧 Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
target: ${{ matrix.target }}
profile: minimal
- name: 🏗️ Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: 🧪 Run tests
if: matrix.target != 'aarch64-pc-windows-msvc'
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
QEMU_LD_PREFIX: /usr/aarch64-linux-gnu
- name: 📦 Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Zenyx-${{ runner.os }}-${{ matrix.arch }}-bin
path: target/${{ matrix.target }}/release/zenyx*