mirror of
https://github.com/telemt/telemt.git
synced 2026-05-24 20:51:44 +03:00
Compare commits
1 Commits
3.3.29
...
dc1a351ca4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc1a351ca4 |
190
.github/workflows/release.yml
vendored
190
.github/workflows/release.yml
vendored
@@ -19,200 +19,104 @@ env:
|
|||||||
BINARY_NAME: telemt
|
BINARY_NAME: telemt
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ==========================
|
build:
|
||||||
# GNU / glibc
|
name: Build ${{ matrix.target }}
|
||||||
# ==========================
|
|
||||||
build-gnu:
|
|
||||||
name: GNU ${{ matrix.target }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
# ===== GNU / glibc =====
|
||||||
- target: x86_64-unknown-linux-gnu
|
- target: x86_64-unknown-linux-gnu
|
||||||
asset: telemt-x86_64-linux-gnu
|
asset_name: telemt-x86_64-linux-gnu
|
||||||
- target: aarch64-unknown-linux-gnu
|
- target: aarch64-unknown-linux-gnu
|
||||||
asset: telemt-aarch64-linux-gnu
|
asset_name: telemt-aarch64-linux-gnu
|
||||||
|
|
||||||
|
# ===== MUSL =====
|
||||||
|
- target: x86_64-unknown-linux-musl
|
||||||
|
asset_name: telemt-x86_64-linux-musl
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# ---------- Toolchain ----------
|
||||||
- uses: dtolnay/rust-toolchain@v1
|
- uses: dtolnay/rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
targets: |
|
targets: |
|
||||||
x86_64-unknown-linux-gnu
|
x86_64-unknown-linux-gnu
|
||||||
aarch64-unknown-linux-gnu
|
aarch64-unknown-linux-gnu
|
||||||
|
x86_64-unknown-linux-musl
|
||||||
|
|
||||||
- name: Install deps
|
# ---------- System deps (bookworm) ----------
|
||||||
|
- name: Install build deps
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y \
|
sudo apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
clang \
|
clang \
|
||||||
lld \
|
lld \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
|
musl-tools \
|
||||||
gcc-aarch64-linux-gnu \
|
gcc-aarch64-linux-gnu \
|
||||||
g++-aarch64-linux-gnu
|
g++-aarch64-linux-gnu \
|
||||||
|
ca-certificates
|
||||||
|
|
||||||
|
# ---------- Cache ----------
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
target
|
target
|
||||||
key: gnu-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
# ---------- Build ----------
|
||||||
- name: Build
|
- name: Build
|
||||||
|
env:
|
||||||
|
CC_x86_64_unknown_linux_gnu: clang
|
||||||
|
CXX_x86_64_unknown_linux_gnu: clang++
|
||||||
|
|
||||||
|
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
|
||||||
|
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
|
||||||
|
|
||||||
|
CC_x86_64_unknown_linux_musl: musl-gcc
|
||||||
|
|
||||||
|
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld"
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
|
case "${{ matrix.target }}" in
|
||||||
export CC=aarch64-linux-gnu-gcc
|
x86_64-unknown-linux-musl)
|
||||||
export CXX=aarch64-linux-gnu-g++
|
export RUSTFLAGS="-C target-feature=+crt-static"
|
||||||
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
|
;;
|
||||||
export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
|
esac
|
||||||
export RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc"
|
|
||||||
else
|
|
||||||
export CC=clang
|
|
||||||
export CXX=clang++
|
|
||||||
export CC_x86_64_unknown_linux_gnu=clang
|
|
||||||
export CXX_x86_64_unknown_linux_gnu=clang++
|
|
||||||
export RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=lld"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cargo build --release --target ${{ matrix.target }}
|
cargo build --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
# ---------- Package ----------
|
||||||
- name: Package
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
|
|
||||||
BIN=target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}
|
BIN=target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}
|
||||||
|
|
||||||
cp "$BIN" dist/${{ env.BINARY_NAME }}-${{ matrix.target }}
|
cp "$BIN" dist/${{ env.BINARY_NAME }}-${{ matrix.target }}
|
||||||
|
|
||||||
cd dist
|
cd dist
|
||||||
tar -czf ${{ matrix.asset }}.tar.gz ${{ env.BINARY_NAME }}-${{ matrix.target }}
|
tar -czf ${{ matrix.asset_name }}.tar.gz ${{ env.BINARY_NAME }}-${{ matrix.target }}
|
||||||
sha256sum ${{ matrix.asset }}.tar.gz > ${{ matrix.asset }}.sha256
|
sha256sum ${{ matrix.asset_name }}.tar.gz > ${{ matrix.asset_name }}.sha256
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.asset }}
|
name: ${{ matrix.asset_name }}
|
||||||
path: |
|
path: |
|
||||||
dist/${{ matrix.asset }}.tar.gz
|
dist/${{ matrix.asset_name }}.tar.gz
|
||||||
dist/${{ matrix.asset }}.sha256
|
dist/${{ matrix.asset_name }}.sha256
|
||||||
|
|
||||||
# ==========================
|
|
||||||
# MUSL
|
|
||||||
# ==========================
|
|
||||||
build-musl:
|
|
||||||
name: MUSL ${{ matrix.target }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: rust:slim-bookworm
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- target: x86_64-unknown-linux-musl
|
|
||||||
asset: telemt-x86_64-linux-musl
|
|
||||||
- target: aarch64-unknown-linux-musl
|
|
||||||
asset: telemt-aarch64-linux-musl
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install deps
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y \
|
|
||||||
musl-tools \
|
|
||||||
pkg-config \
|
|
||||||
curl
|
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
if: matrix.target == 'aarch64-unknown-linux-musl'
|
|
||||||
with:
|
|
||||||
path: ~/.musl-aarch64
|
|
||||||
key: musl-toolchain-aarch64-v1
|
|
||||||
|
|
||||||
- name: Install aarch64 musl toolchain
|
|
||||||
if: matrix.target == 'aarch64-unknown-linux-musl'
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
|
|
||||||
TOOLCHAIN_DIR="$HOME/.musl-aarch64"
|
|
||||||
ARCHIVE="aarch64-linux-musl-cross.tgz"
|
|
||||||
URL="https://github.com/telemt/telemt/releases/download/toolchains/$ARCHIVE"
|
|
||||||
|
|
||||||
if [ -x "$TOOLCHAIN_DIR/bin/aarch64-linux-musl-gcc" ]; then
|
|
||||||
echo "✅ MUSL toolchain already installed"
|
|
||||||
else
|
|
||||||
echo "⬇️ Downloading musl toolchain from Telemt GitHub Releases..."
|
|
||||||
|
|
||||||
curl -fL \
|
|
||||||
--retry 5 \
|
|
||||||
--retry-delay 3 \
|
|
||||||
--connect-timeout 10 \
|
|
||||||
--max-time 120 \
|
|
||||||
-o "$ARCHIVE" "$URL"
|
|
||||||
|
|
||||||
mkdir -p "$TOOLCHAIN_DIR"
|
|
||||||
tar -xzf "$ARCHIVE" --strip-components=1 -C "$TOOLCHAIN_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$TOOLCHAIN_DIR/bin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Add rust target
|
|
||||||
run: rustup target add ${{ matrix.target }}
|
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/usr/local/cargo/registry
|
|
||||||
/usr/local/cargo/git
|
|
||||||
target
|
|
||||||
key: musl-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-musl" ]; then
|
|
||||||
export CC=aarch64-linux-musl-gcc
|
|
||||||
export CC_aarch64_unknown_linux_musl=aarch64-linux-musl-gcc
|
|
||||||
export RUSTFLAGS="-C target-feature=+crt-static -C linker=aarch64-linux-musl-gcc"
|
|
||||||
else
|
|
||||||
export CC=musl-gcc
|
|
||||||
export CC_x86_64_unknown_linux_musl=musl-gcc
|
|
||||||
export RUSTFLAGS="-C target-feature=+crt-static"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cargo build --release --target ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Package
|
|
||||||
run: |
|
|
||||||
mkdir -p dist
|
|
||||||
BIN=target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}
|
|
||||||
|
|
||||||
cp "$BIN" dist/${{ env.BINARY_NAME }}-${{ matrix.target }}
|
|
||||||
|
|
||||||
cd dist
|
|
||||||
tar -czf ${{ matrix.asset }}.tar.gz ${{ env.BINARY_NAME }}-${{ matrix.target }}
|
|
||||||
sha256sum ${{ matrix.asset }}.tar.gz > ${{ matrix.asset }}.sha256
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.asset }}
|
|
||||||
path: |
|
|
||||||
dist/${{ matrix.asset }}.tar.gz
|
|
||||||
dist/${{ matrix.asset }}.sha256
|
|
||||||
|
|
||||||
# ==========================
|
|
||||||
# Docker
|
|
||||||
# ==========================
|
|
||||||
docker:
|
docker:
|
||||||
name: Docker
|
name: Docker
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-gnu, build-musl]
|
needs: build
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -243,10 +147,11 @@ jobs:
|
|||||||
id: vars
|
id: vars
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build & Push
|
- name: Build & Push prod
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
target: prod
|
||||||
push: true
|
push: true
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: |
|
tags: |
|
||||||
@@ -255,13 +160,10 @@ jobs:
|
|||||||
build-args: |
|
build-args: |
|
||||||
BINARY=dist/telemt
|
BINARY=dist/telemt
|
||||||
|
|
||||||
# ==========================
|
|
||||||
# Release
|
|
||||||
# ==========================
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-gnu, build-musl]
|
needs: build
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
Reference in New Issue
Block a user