Skip to content

Commit

Permalink
feat: aarch64 support for linux too
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesw committed Oct 10, 2023
1 parent 62394d8 commit 2f8baa1
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 6 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build

on:
workflow_dispatch:

jobs:
publish:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu

- os: ubuntu-latest
target: aarch64-unknown-linux-gnu

- os: ubuntu-latest
target: x86_64-unknown-linux-musl

- os: windows-latest
target: x86_64-pc-windows-msvc

- os: macos-latest
target: x86_64-apple-darwin

- os: macos-latest
target: aarch64-apple-darwin

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}

- name: Configures Binary stripping
run: |
mkdir -p .cargo
echo '[build]' >> .cargo/config.toml
echo 'rustflags = ["-C", "link-args=-s"]' >> .cargo/config.toml
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --target ${{ matrix.target }} --release

- name: generate git_sha short
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Check sha_short
run: echo "${{ steps.vars.outputs.sha_short }}"

- name: Upload binaries as artifacts
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
with:
name: upt-${{ matrix.target }}-${{ steps.vars.outputs.sha_short }}
path: target/${{ matrix.target }}/release/upt

- name: Upload binaries as artifacts
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: upt-${{ matrix.target }}-${{ steps.vars.outputs.sha_short }}.exe
path: target/${{ matrix.target }}/release/upt

28 changes: 22 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu

- os: ubuntu-latest
target: aarch64-unknown-linux-gnu

- os: ubuntu-latest
target: x86_64-unknown-linux-musl

Expand All @@ -42,20 +45,32 @@ jobs:
override: true
target: ${{ matrix.target }}

- name: Configures Binary stripping
run: |
mkdir -p .cargo
echo '[build]' >> .cargo/config.toml
echo 'rustflags = ["-C", "link-args=-s"]' >> .cargo/config.toml
- name: Build
run: cargo build --release --locked
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --target ${{ matrix.target }} --release

- name: Strip binary
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: strip target/release/upt
- name: generate git_sha short
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Check sha_short
run: echo "${{ steps.vars.outputs.sha_short }}"

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/upt
file: target/${{ matrix.target }}/release/upt
asset_name: upt-${{ matrix.target }}
tag: ${{ github.ref }}

Expand All @@ -64,6 +79,7 @@ jobs:
if: matrix.os == 'windows-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/upt.exe
file: target/${{ matrix.target }}/release/upt.exe
asset_name: upt-${{ matrix.target }}.exe
tag: ${{ github.ref }}

0 comments on commit 2f8baa1

Please sign in to comment.