update github action
Former-commit-id: 2e02f0610e40a20f6a822920686e2093341cc1b2 [formerly 3a475d12112dbe62bec6e71d599f14a7663f72fc] [formerly 546e817db5e5a41d3c92e336e6b512a76f63dc36 [formerly 2cc4688dcb98847b08672aec11c171148eeeddb5]] Former-commit-id: 8f59a3d7432bbad7162f502203e1ed3f26b253dd [formerly c1a3c9bffc72171a01265cc2024c82b0eb2c8d24] Former-commit-id: 4b20d9c9edc001b6780fdea235a33efb69fc3954 Former-commit-id: d77b1e8d81518bd776a3c9ac8279062f75dacec6 Former-commit-id: ceaa787ed318f5403eee8367a6a820e614528d02 Former-commit-id: 0f4645cd044c3e119cbf8893564ffec8033cc034 [formerly cf641e89e044f8c568ee80fa4c47df8c0c4f9911] Former-commit-id: 193fc0fc36b0f49976e502a0c5d4b3396d8be7c5
This commit is contained in:
parent
9ef71bc2af
commit
28e1fa032d
2 changed files with 143 additions and 137 deletions
102
.github/workflows/build.yaml
vendored
Normal file
102
.github/workflows/build.yaml
vendored
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
on:
|
||||||
|
# Indicates I want to run this workflow on all branches, PR, and tags
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
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
|
||||||
|
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: ${{ env.BIN_NAME }}-${{ matrix.platform.target }}
|
||||||
|
path: target/${{ matrix.platform.target }}/release/${{ env.BIN_NAME }}${{ contains(matrix.platform.target, 'windows') && '.exe' || '' }}
|
||||||
|
retention-days: 1
|
||||||
|
|
104
.github/workflows/release.yaml
vendored
104
.github/workflows/release.yaml
vendored
|
@ -1,108 +1,12 @@
|
||||||
on:
|
on:
|
||||||
# Indicates I want to run this workflow on all branches, PR, and tags
|
workflow_run:
|
||||||
push:
|
workflows: [build]
|
||||||
branches: ["main"]
|
types:
|
||||||
tags: ["*"]
|
- completed
|
||||||
pull_request:
|
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
RUST_VERSION: 1.73.0
|
|
||||||
BUILD_ARGS: "--release"
|
|
||||||
BIN_NAME: "wstunnel"
|
|
||||||
|
|
||||||
jobs:
|
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
|
|
||||||
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: ${{ env.BIN_NAME }}-${{ matrix.platform.target }}
|
|
||||||
path: target/${{ matrix.platform.target }}/release/${{ env.BIN_NAME }}${{ contains(matrix.platform.target, 'windows') && '.exe' || '' }}
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
needs: [build]
|
|
||||||
# We run the release job only if a tag starts with 'v' letter
|
# We run the release job only if a tag starts with 'v' letter
|
||||||
if: startsWith( github.ref, 'refs/tags/v' )
|
if: startsWith( github.ref, 'refs/tags/v' )
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
Loading…
Reference in a new issue