From 10ccd1a18ab6d11aad5bebac3d943f529266d540 Mon Sep 17 00:00:00 2001 From: My CTO Date: Thu, 16 Jan 2025 09:49:01 +0100 Subject: [PATCH] Explicitly separate two linux architecture build actions on GH actions --- .github/workflows/release.yml | 67 ++++++++++++++++++++--------------- .gitignore | 1 + 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0a13a9..2e4f882 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 \ No newline at end of file + name: anypay-websockets-linux-aarch64 + path: target/aarch64-unknown-linux-gnu/release/anypay-websockets diff --git a/.gitignore b/.gitignore index c5dd462..bdb258e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ target .env +**.swp