Former-commit-id: e733111c91cb1e97a1a83e871e276abf8932e06f [formerly afdfb957095a1f4ec857225f67587fd59dc6b43a] [formerly 7f15f69bb27f8b778ce81b9ca983c2260480382d [formerly 1fd1288cb05c3e5e26f374ce9b7873f990d65b01]]
Former-commit-id: 9b3a9ea64d414fa9ea0a283293d805dc5a0f90c8 [formerly e7dae3aae96e9718868af5dc5213269ccd198c9c]
Former-commit-id: 07f4549c8f0b2e8fa5f93ac1089886932c5f4c49
Former-commit-id: 7b14a2155035f3a40dbb62c2056091ad35cfefe1
Former-commit-id: 7b055e4fde439c962e52f255f4d186db2baa7b7c
Former-commit-id: 40d5e9dde7c8ada4940d49ac367173c41f47c562 [formerly b8e58804e55e540f574707e9b762e45b91266c88]
Former-commit-id: 1775c08d28d9d5f63bad987bf022d56f18f92253
This commit is contained in:
Σrebe - Romain GERARD 2023-10-18 17:05:02 +02:00
parent 1c4205ff39
commit f3b01dc9c8
2 changed files with 129 additions and 129 deletions

View file

@ -1,128 +1,128 @@
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
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
# Goreleaser
- name: Set up Go
uses: actions/setup-go@v4
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
# Run goreleaser and ignore non-committed files (downloaded artifacts)
args: release --clean --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
#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
# 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
#
# # Goreleaser
# - name: Set up Go
# uses: actions/setup-go@v4
# - name: Run GoReleaser
# uses: goreleaser/goreleaser-action@v5
# with:
# distribution: goreleaser
# version: latest
# # Run goreleaser and ignore non-committed files (downloaded artifacts)
# args: release --clean --skip=validate
# env:
# GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}

View file

@ -60,6 +60,6 @@ ci = ["github"]
# The installers to generate for each app
installers = []
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-pc-windows-msvc"]
targets = ["armv7-unknown-linux-musleabihf", "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc"]
# Publish jobs to run in CI
pr-run-mode = "skip"