eb63954636
Former-commit-id: ba40ad189da895c4d87f3ebb0ee173c2c6e35c2b [formerly f0ee186b2bc2f1a33b8065f26a18fa4180d86b88] [formerly 7343e47591d034d29abdaab8466cf7a03b435b65 [formerly 2348b5b41dd90ed48bd9d2d52e527f6e16ab0bc0]] Former-commit-id: 9c5d773daf86809c40d30c8b34a2d0660298579b [formerly ea1b0885c83536f7f535dbad8d05b065c1f4a606] Former-commit-id: 99f0ce7f84656e92f045062b0b1b2df28ab60590 Former-commit-id: f6558fef11b33540f435eb70ddd816546c41c84d Former-commit-id: c73a427c4ad0eaa4c2c8b98d25b07362b0c61b73 Former-commit-id: 373186b8a24a6ff1fdf334f92ba1e67b23a5dd08 [formerly 0e3528caf8589a15301165938635cbd627b41895] Former-commit-id: c42595a57473c8abb11bad4046c7d5be7f6c0448
116 lines
3.6 KiB
YAML
116 lines
3.6 KiB
YAML
on:
|
|
# Indicates I want to run this workflow on all branches, PR, and tags
|
|
push:
|
|
branches: ["neo"]
|
|
tags: ["*"]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
env:
|
|
RUST_VERSION: 1.73.0
|
|
BUILD_ARGS: "--release"
|
|
BIN_NAME: "wstunnel"
|
|
|
|
jobs:
|
|
build:
|
|
name: Build - ${{ matrix.platform.name }}
|
|
# By default, runs on Ubuntu, otherwise, override with the desired os
|
|
runs-on: ${{ matrix.platform.os || 'ubuntu-22.04' }}
|
|
strategy:
|
|
matrix:
|
|
# Set platforms you want to build your binaries on
|
|
platform:
|
|
# Linux
|
|
- name: Linux x86_64
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
- name: Linux aarch64
|
|
target: aarch64-unknown-linux-musl
|
|
|
|
- name: Linux armv7hf
|
|
target: armv7-unknown-linux-musleabihf
|
|
|
|
- name: Linux mips
|
|
target: mips-unknown-linux-musl
|
|
|
|
- name: Linux mips64
|
|
target: mips64-unknown-linux-muslabi64
|
|
|
|
# Mac OS
|
|
- name: MacOS x86_64
|
|
target: x86_64-apple-darwin
|
|
|
|
- name: iOS x86_64
|
|
target: x86_64-apple-ios
|
|
|
|
- name: MacOS aarch64
|
|
target: aarch64-apple-darwin
|
|
|
|
- name: iOS aarch64
|
|
target: aarch64-apple-ios
|
|
|
|
|
|
# Windows
|
|
# - name: Windows x86_64
|
|
# # Use another GitHub action OS
|
|
# os: windows-latest
|
|
# target: x86_64-pc-windows-msvc
|
|
|
|
steps:
|
|
- name: Create annotation for build error
|
|
if: contains(matrix.platform.target, 'linux')
|
|
run: sudo apt install musl-tools
|
|
|
|
- name: Checkout Git repo
|
|
uses: actions/checkout@v3
|
|
|
|
# Linux & Windows
|
|
- name: Install rust toolchain
|
|
if: ${{ !contains(matrix.platform.target, 'apple') }}
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
# We setup Rust toolchain and the desired target
|
|
profile: minimal
|
|
toolchain: "${{ env.RUST_VERSION }}"
|
|
override: true
|
|
target: ${{ matrix.platform.target }}
|
|
components: rustfmt, clippy
|
|
- name: Build ${{ matrix.platform.name }} binary
|
|
if: ${{ !contains(matrix.platform.target, 'apple') }}
|
|
uses: actions-rs/cargo@v1
|
|
# We use cross-rs if not running on x86_64 architecture on Linux
|
|
with:
|
|
command: build
|
|
use-cross: ${{ !contains(matrix.platform.target, 'x86_64') }}
|
|
args: ${{ env.BUILD_ARGS }} --target ${{ matrix.platform.target }}
|
|
|
|
# Mac OS
|
|
- name: Build ${{ matrix.platform.name }} binary
|
|
if: contains(matrix.platform.target, 'apple')
|
|
# We use a dedicated Rust image containing required Apple libraries to cross-compile on multiple archs
|
|
run: |
|
|
docker run --rm --volume "${PWD}":/root/src --workdir /root/src joseluisq/rust-linux-darwin-builder:$RUST_VERSION \
|
|
sh -c "CC=o64-clang CXX=o64-clang++ cargo build $BUILD_ARGS --target ${{ matrix.platform.target }}"
|
|
|
|
- name: Store artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
# Finally, we store the binary as GitHub artifact for later usage
|
|
name: ${{ matrix.platform.target }}-${{ env.BIN_NAME }}
|
|
path: target/${{ matrix.platform.target }}/release/${{ env.BIN_NAME }}${{ contains(matrix.platform.target, 'windows') && '.exe' || '' }}
|
|
retention-days: 1
|
|
|
|
release:
|
|
name: Release
|
|
needs: [build]
|
|
# We run the release job only if a tag starts with 'v' letter
|
|
if: startsWith( github.ref, 'refs/tags/v' )
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout Git repo
|
|
uses: actions/checkout@v3
|
|
|
|
# Download all artifacts
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
path: artifacts
|