mirror of https://github.com/ospab/ostp.git
CI/CD: Introduce Enterprise GitHub Actions release matrix & enrich local build with FreeBSD
This commit is contained in:
parent
f071e8309e
commit
c58ca91ed5
|
|
@ -0,0 +1,139 @@
|
||||||
|
name: Universal CI/CD Release Matrix
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-release-matrix:
|
||||||
|
name: Release for ${{ matrix.target }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
# ==========================================
|
||||||
|
# 🏁 WINDOWS ECOSYSTEM
|
||||||
|
# ==========================================
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
artifact_name: ostp.exe
|
||||||
|
release_name: ostp-windows-amd64.zip
|
||||||
|
- os: windows-latest
|
||||||
|
target: i686-pc-windows-msvc
|
||||||
|
artifact_name: ostp.exe
|
||||||
|
release_name: ostp-windows-386.zip
|
||||||
|
- os: windows-latest
|
||||||
|
target: aarch64-pc-windows-msvc
|
||||||
|
artifact_name: ostp.exe
|
||||||
|
release_name: ostp-windows-arm64.zip
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 🍏 APPLE DARWIN (macOS)
|
||||||
|
# ==========================================
|
||||||
|
- os: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-darwin-amd64.tar.gz
|
||||||
|
- os: macos-latest
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-darwin-arm64.tar.gz
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 🐧 LINUX & FreeBSD STANDARD
|
||||||
|
# ==========================================
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-linux-amd64.tar.gz
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: i686-unknown-linux-musl
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-linux-386.tar.gz
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: aarch64-unknown-linux-musl
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-linux-arm64.tar.gz
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: armv7-unknown-linux-musleabihf
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-linux-armv7.tar.gz
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-freebsd
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-freebsd-amd64.tar.gz
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 🛰️ ROUTER & SPECIAL ARCHITECTURES (Cross)
|
||||||
|
# ==========================================
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: mipsel-unknown-linux-musl
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-linux-mipsle.tar.gz
|
||||||
|
use_cross: true
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: riscv64gc-unknown-linux-gnu
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-linux-riscv64.tar.gz
|
||||||
|
use_cross: true
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 🤖 MOBILE & EMBEDDED SUITE (Cross)
|
||||||
|
# ==========================================
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: aarch64-linux-android
|
||||||
|
artifact_name: ostp
|
||||||
|
release_name: ostp-android-arm64.tar.gz
|
||||||
|
use_cross: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Initialize Rust ecosystem
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Activate rust compilation caching
|
||||||
|
uses: swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: Setup local MUSL linker dependencies
|
||||||
|
if: matrix.os == 'ubuntu-latest' && !matrix.use_cross
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y musl-tools
|
||||||
|
|
||||||
|
- name: Execute Standard Native Compilation
|
||||||
|
if: !matrix.use_cross
|
||||||
|
run: cargo build --release --target ${{ matrix.target }} --bin ostp
|
||||||
|
|
||||||
|
- name: Execute Specialized Cross-Compilation
|
||||||
|
if: matrix.use_cross
|
||||||
|
run: |
|
||||||
|
cargo install cross --git https://github.com/cross-rs/cross.git
|
||||||
|
cross build --release --target ${{ matrix.target }} --bin ostp
|
||||||
|
|
||||||
|
- name: Package release artifact (Windows)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
cd target/${{ matrix.target }}/release
|
||||||
|
Compress-Archive -Path ${{ matrix.artifact_name }} -DestinationPath ../../../${{ matrix.release_name }}
|
||||||
|
|
||||||
|
- name: Package release artifact (Unix Systems)
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
run: |
|
||||||
|
cd target/${{ matrix.target }}/release
|
||||||
|
tar -czf ../../../${{ matrix.release_name }} ${{ matrix.artifact_name }}
|
||||||
|
|
||||||
|
- name: Inject artifact to Global GitHub Release Assets
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: ${{ matrix.release_name }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
@ -85,7 +85,7 @@ foreach ($item in $WindowsTargets) {
|
||||||
if ($Flatten) {
|
if ($Flatten) {
|
||||||
$RawReleaseDir = Join-Path $DistDir "release"
|
$RawReleaseDir = Join-Path $DistDir "release"
|
||||||
New-Item -ItemType Directory -Force -Path $RawReleaseDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $RawReleaseDir | Out-Null
|
||||||
$FlatName = "ostp-$arch.exe"
|
$FlatName = "ostp-windows-$arch.exe"
|
||||||
Copy-Item -Path $compiledBin -Destination (Join-Path $RawReleaseDir $FlatName) -Force
|
Copy-Item -Path $compiledBin -Destination (Join-Path $RawReleaseDir $FlatName) -Force
|
||||||
Write-Output " -> Flat copied: dist/release/$FlatName"
|
Write-Output " -> Flat copied: dist/release/$FlatName"
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +115,8 @@ if (Get-Command wsl -ErrorAction SilentlyContinue) {
|
||||||
@{ Target = "x86_64-unknown-linux-musl"; Arch = "x64"; BinaryName = "ostp" },
|
@{ Target = "x86_64-unknown-linux-musl"; Arch = "x64"; BinaryName = "ostp" },
|
||||||
@{ Target = "i686-unknown-linux-musl"; Arch = "x86"; BinaryName = "ostp" },
|
@{ Target = "i686-unknown-linux-musl"; Arch = "x86"; BinaryName = "ostp" },
|
||||||
@{ Target = "aarch64-unknown-linux-musl"; Arch = "arm64"; BinaryName = "ostp" },
|
@{ Target = "aarch64-unknown-linux-musl"; Arch = "arm64"; BinaryName = "ostp" },
|
||||||
@{ Target = "armv7-unknown-linux-musleabihf"; Arch = "armv7"; BinaryName = "ostp" }
|
@{ Target = "armv7-unknown-linux-musleabihf"; Arch = "armv7"; BinaryName = "ostp" },
|
||||||
|
@{ Target = "x86_64-unknown-freebsd"; Arch = "x64"; BinaryName = "ostp" }
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach ($item in $LinuxTargets) {
|
foreach ($item in $LinuxTargets) {
|
||||||
|
|
@ -123,7 +124,10 @@ if (Get-Command wsl -ErrorAction SilentlyContinue) {
|
||||||
$arch = $item.Arch
|
$arch = $item.Arch
|
||||||
$bin = $item.BinaryName
|
$bin = $item.BinaryName
|
||||||
|
|
||||||
Write-Output "--> Compiling target: Linux $arch [$target] via rust-lld..."
|
$osPrefix = "linux"
|
||||||
|
if ($target -match "freebsd") { $osPrefix = "freebsd" }
|
||||||
|
|
||||||
|
Write-Output "--> Compiling target: $osPrefix $arch [$target] via rust-lld..."
|
||||||
|
|
||||||
& wsl rustup target add $target 2>&1 | Out-Null
|
& wsl rustup target add $target 2>&1 | Out-Null
|
||||||
|
|
||||||
|
|
@ -133,8 +137,8 @@ if (Get-Command wsl -ErrorAction SilentlyContinue) {
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
$compiledBin = Join-Path $LinuxBuildDir "$target\release\$bin"
|
$compiledBin = Join-Path $LinuxBuildDir "$target\release\$bin"
|
||||||
if (Test-Path $compiledBin) {
|
if (Test-Path $compiledBin) {
|
||||||
$archiveName = "ostp-v$Version-linux-$arch.tar.gz"
|
$archiveName = "ostp-v$Version-$osPrefix-$arch.tar.gz"
|
||||||
$targetStaging = Join-Path $StagingDir "linux-$arch"
|
$targetStaging = Join-Path $StagingDir "$osPrefix-$arch"
|
||||||
New-Item -ItemType Directory -Force -Path $targetStaging | Out-Null
|
New-Item -ItemType Directory -Force -Path $targetStaging | Out-Null
|
||||||
|
|
||||||
Copy-Item -Path $compiledBin -Destination $targetStaging -Force
|
Copy-Item -Path $compiledBin -Destination $targetStaging -Force
|
||||||
|
|
@ -152,7 +156,7 @@ if (Get-Command wsl -ErrorAction SilentlyContinue) {
|
||||||
if ($Flatten) {
|
if ($Flatten) {
|
||||||
$RawReleaseDir = Join-Path $DistDir "release"
|
$RawReleaseDir = Join-Path $DistDir "release"
|
||||||
New-Item -ItemType Directory -Force -Path $RawReleaseDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $RawReleaseDir | Out-Null
|
||||||
$FlatName = "ostp-$arch"
|
$FlatName = "ostp-$osPrefix-$arch"
|
||||||
Copy-Item -Path $compiledBin -Destination (Join-Path $RawReleaseDir $FlatName) -Force
|
Copy-Item -Path $compiledBin -Destination (Join-Path $RawReleaseDir $FlatName) -Force
|
||||||
Write-Output " -> Flat copied: dist/release/$FlatName"
|
Write-Output " -> Flat copied: dist/release/$FlatName"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue