Skip to content

Commit

Permalink
Add release build for arm64 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximik authored Nov 20, 2024
1 parent c8ba99f commit 5633421
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 271 deletions.
45 changes: 28 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,53 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, macos-13] # Specify the runners you want to use
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-13
target: x86_64-apple-darwin

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Dynamically create a tag from the pushed version
- name: Get the tag name
id: get_tag
run: |
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}

- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build release binary
run: cargo build --release
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: |
cargo build --release --target ${{ matrix.target }}
# Perhaps we can ignore tests, as they are run by the CI workflow
# - name: Run tests
# run: cargo test --release
#

- name: Get OS and architecture
run: |
echo "os=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "arch=$(uname -m)" >> $GITHUB_ENV
echo "OS=$(echo ${{ matrix.target }} | grep -q 'linux' && echo 'linux' || echo 'darwin')" >> $GITHUB_ENV
echo "ARCH=$(echo ${{ matrix.target }} | grep -q 'aarch64' && echo 'arm64' || echo 'x86_64')" >> $GITHUB_ENV
- name: Create release archive
run: |
mkdir -p release
ARCH="${{ env.arch }}"
OS="${{ env.os }}"
cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH}
cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH}
mkdir -p spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}
cp target/${{ matrix.target }}/release/spaced spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}/spaced
cp target/${{ matrix.target }}/release/space-cli spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}/space-cli
tar -czf spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}
- name: Create GitHub Release
id: create_release
Expand All @@ -57,8 +69,7 @@ jobs:
draft: false
prerelease: false
files: |
release/spaced-${{ env.TAG }}-${{ env.os }}-${{ env.arch }}
release/space-cli-${{ env.TAG }}-${{ env.os }}-${{ env.arch }}
spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 5633421

Please sign in to comment.