Skip to content

Commit

Permalink
Explicitly separate two linux architecture build actions on GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
owenkellogg committed Jan 16, 2025
1 parent bb66812 commit 10ccd1a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
67 changes: 38 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,8 @@ on:
- 'v*'

jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: anypay-websockets-linux-x86_64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: anypay-websockets-linux-arm64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: anypay-websockets-macos-x86_64
- os: macos-14 # For M1/M2
target: aarch64-apple-darwin
artifact_name: anypay-websockets-macos-arm64

runs-on: ${{ matrix.os }}
build-linux-x86:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
Expand All @@ -32,31 +16,56 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
target: x86_64-unknown-linux-gnu
override: true

- name: Install Cross-Compilation Tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
- name: Build
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
tar -czf anypay-websockets-linux-x86_64.tar.gz -C target/x86_64-unknown-linux-gnu/release anypay-websockets
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
anypay-websockets-linux-x86_64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: anypay-websockets-linux-x86_64
path: target/x86_64-unknown-linux-gnu/release/anypay-websockets

build-linux-aarch64:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-unknown-linux-gnu
override: true

- name: Build
run: |
cargo build --release --target ${{ matrix.target }}
tar -czf ${{ matrix.artifact_name }}.tar.gz -C target/${{ matrix.target }}/release anypay-websockets
cargo build --release --target aarch64-unknown-linux-gnu
tar -czf anypay-websockets-linux-aarch64.tar.gz -C target/aarch64-unknown-linux-gnu/release anypay-websockets
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ matrix.artifact_name }}.tar.gz
anypay-websockets-linux-aarch64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact_name }}
path: target/${{ matrix.target }}/release/anypay-websockets
name: anypay-websockets-linux-aarch64
path: target/aarch64-unknown-linux-gnu/release/anypay-websockets
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
.env
**.swp

0 comments on commit 10ccd1a

Please sign in to comment.