Skip to content

Build and release uplink binaries #131

Build and release uplink binaries

Build and release uplink binaries #131

Workflow file for this run

name: Build and release uplink binaries
on:
release:
types: [published]
jobs:
release-tools:
name: Build tools/${{ matrix.build }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build: [system-stats]
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-unknown-linux-musl
- name: Build binary
working-directory: tools/${{ matrix.build }}
run: cargo build --verbose --release --target x86_64-unknown-linux-musl
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: tools/${{ matrix.build }}/target/x86_64-unknown-linux-musl/release/${{ matrix.build }}
build-release:
name: Build release for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [linux, macos, linux-arm-gnu, windows]
include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: macos-m1
os: macos-latest
rust: stable
target: aarch64-apple-darwin
- build: linux-arm-gnu
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-gnueabihf
- build: linux-aarch-musl
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-musl
- build: linux-aarch-gnu
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
- build: windows
os: ubuntu-latest
rust: stable
target: x86_64-pc-windows-gnu
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Use Cross
shell: bash
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
- name: Build release binary
run: cross build --verbose --release ${{ env.TARGET_FLAGS }}
- name: Strip release binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos' || matrix.build == 'macos-m1'
run: strip "target/${{ matrix.target }}/release/uplink"
- name: Strip release binary (armv7)
if: matrix.build == 'linux-arm-gnu'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:armv7-unknown-linux-gnueabihf \
arm-linux-gnueabihf-strip \
/target/armv7-unknown-linux-gnueabihf/release/uplink
- name: Strip release binary (aarch-musl)
if: matrix.build == 'linux-aarch-musl'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:aarch64-unknown-linux-musl \
aarch64-linux-musl-strip \
/target/aarch64-unknown-linux-musl/release/uplink
- name: Strip release binary (aarch-gnu)
if: matrix.build == 'linux-aarch-gnu'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:aarch64-unknown-linux-gnu \
aarch64-linux-gnu-strip \
/target/aarch64-unknown-linux-gnu/release/uplink
- name: Rename ${{ matrix.target }} binary
if: matrix.build != 'windows'
run: mv "target/${{ matrix.target }}/release/uplink" "uplink-${{ matrix.target }}"
- name: Rename ${{ matrix.target }} binary
if: matrix.build == 'windows'
run: mv "target/${{ matrix.target }}/release/uplink.exe" "uplink-${{ matrix.target }}.exe"
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: uplink*
build-release-android:
name: Build release for android
runs-on: ubuntu-latest
container:
image: bytebeamio/rust-android
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: perms
run: chown root:root .
- name: Build for armv7
run: cargo ndk --target armv7-linux-androideabi --platform 23 build --release --bin uplink
- name: Build for aarch64
run: cargo ndk --target aarch64-linux-android --platform 23 build --release --bin uplink
- name: Rename uplink binaries
run: |
mv "target/aarch64-linux-android/release/uplink" "uplink-aarch64-linux-android"
mv "target/armv7-linux-androideabi/release/uplink" "uplink-armv7-linux-androideabi"
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: uplink*