Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
add more targets in build-and-release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
EAimTY committed Mar 20, 2022
1 parent 83c59fb commit 916f002
Showing 1 changed file with 46 additions and 18 deletions.
64 changes: 46 additions & 18 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,48 @@ jobs:
fail-fast: false
matrix:
include:
# x86_64-linux
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cross: false
arch-name: x86_64-linux
file-ext:
# x86_64-windows
- os: windows-latest
target: x86_64-pc-windows-msvc
cross: false
arch-name: x86_64-windows
file-ext: .exe
# x86_64-macos
- os: macos-latest
target: x86_64-apple-darwin
cross: false
arch-name: x86_64-macos
file-ext:
# aarch64-linux
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross: true
arch-name: aarch64-linux
file-ext:
# aarch64-macos
- os: macos-latest
target: aarch64-apple-darwin
cross: true
arch-name: aarch64-macos
file-ext:
# aarch64-android
- os: ubuntu-latest
target: aarch64-linux-android
cross: true
arch-name: aarch64-android
file-ext:
# aarch64-ios
- os: macos-latest
target: aarch64-apple-ios
cross: true
arch-name: aarch64-ios
file-ext:

runs-on: ${{ matrix.os }}

Expand All @@ -37,33 +70,28 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.target }}
override: true

- name: Build server
run: cargo build --release -p tuic-server
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release -p tuic-server --target ${{ matrix.target }}

- name: Build client
run: cargo build --release -p tuic-client
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release -p tuic-client --target ${{ matrix.target }}

- name: Move binaries
run: |
mkdir artifacts/
mv target/release/tuic-server${{ matrix.file-ext }} artifacts/tuic-server-${{ steps.tag.outputs.tag }}-${{ matrix.arch-name }}${{ matrix.file-ext }}
mv target/release/tuic-client${{ matrix.file-ext }} artifacts/tuic-client-${{ steps.tag.outputs.tag }}-${{ matrix.arch-name }}${{ matrix.file-ext }}
- name: Compress server binary
uses: svenstaro/upx-action@v2
with:
file: artifacts/tuic-server-${{ steps.tag.outputs.tag }}-${{ matrix.arch-name }}${{ matrix.file-ext }}
args: --best
strip: false

- name: Compress client binary
uses: svenstaro/upx-action@v2
with:
file: artifacts/tuic-client-${{ steps.tag.outputs.tag }}-${{ matrix.arch-name }}${{ matrix.file-ext }}
args: --best
strip: false
mv target/${{ matrix.target }}/release/tuic-server${{ matrix.file-ext }} artifacts/tuic-server-${{ steps.tag.outputs.tag }}-${{ matrix.arch-name }}${{ matrix.file-ext }}
mv target/${{ matrix.target }}/release/tuic-client${{ matrix.file-ext }} artifacts/tuic-client-${{ steps.tag.outputs.tag }}-${{ matrix.arch-name }}${{ matrix.file-ext }}
- name: Calculate SHA256
run: |
Expand Down

0 comments on commit 916f002

Please sign in to comment.