ci(glibc): packaging for older linux distros

This commit is contained in:
Alexandre Pasmantier 2025-02-08 00:20:22 +01:00
parent 11e440c151
commit bb727bd070

View File

@ -43,6 +43,7 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
# macos x86_64
- os: macos-latest - os: macos-latest
os-name: macos os-name: macos
target: x86_64-apple-darwin target: x86_64-apple-darwin
@ -50,6 +51,7 @@ jobs:
binary-postfix: "" binary-postfix: ""
binary-name: tv binary-name: tv
use-cross: false use-cross: false
# macos arm64
- os: macos-latest - os: macos-latest
os-name: macos os-name: macos
target: aarch64-apple-darwin target: aarch64-apple-darwin
@ -57,13 +59,7 @@ jobs:
binary-postfix: "" binary-postfix: ""
use-cross: false use-cross: false
binary-name: tv binary-name: tv
- os: ubuntu-latest # windows x86_64
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
binary-postfix: ""
use-cross: false
binary-name: tv
- os: windows-latest - os: windows-latest
os-name: windows os-name: windows
target: x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc
@ -71,6 +67,7 @@ jobs:
binary-postfix: ".exe" binary-postfix: ".exe"
use-cross: false use-cross: false
binary-name: tv binary-name: tv
# linux aaarch64
- os: ubuntu-latest - os: ubuntu-latest
os-name: linux os-name: linux
target: aarch64-unknown-linux-gnu target: aarch64-unknown-linux-gnu
@ -78,6 +75,7 @@ jobs:
binary-postfix: "" binary-postfix: ""
use-cross: true use-cross: true
binary-name: tv binary-name: tv
# linux i686
- os: ubuntu-latest - os: ubuntu-latest
os-name: linux os-name: linux
target: i686-unknown-linux-gnu target: i686-unknown-linux-gnu
@ -85,6 +83,14 @@ jobs:
binary-postfix: "" binary-postfix: ""
use-cross: true use-cross: true
binary-name: tv binary-name: tv
# linux x86_64
- os: ubuntu-latest
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
binary-postfix: ""
use-cross: false
binary-name: tv
steps: steps:
- name: Checkout repository - name: Checkout repository
@ -93,46 +99,36 @@ jobs:
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
target: ${{ matrix.target }} target: ${{ matrix.target }}
profile: minimal profile: minimal
override: true override: true
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Cargo build - name: Cargo build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
use-cross: ${{ matrix.use-cross }} use-cross: ${{ matrix.use-cross }}
toolchain: stable toolchain: stable
args: --release --target ${{ matrix.target }} args: --release --target ${{ matrix.target }}
- name: install strip command - name: install strip command
shell: bash shell: bash
run: | run: |
if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
sudo apt update sudo apt update
sudo apt-get install -y binutils-aarch64-linux-gnu sudo apt-get install -y binutils-aarch64-linux-gnu
fi fi
- name: Packaging final binary - name: Packaging final binary
shell: bash shell: bash
run: | run: |
cd target/${{ matrix.target }}/release cd target/${{ matrix.target }}/release
####### reduce binary size by removing debug symbols ####### ####### reduce binary size by removing debug symbols #######
BINARY_NAME=${{ matrix.binary-name }}${{ matrix.binary-postfix }} BINARY_NAME=${{ matrix.binary-name }}${{ matrix.binary-postfix }}
echo "BINARY_NAME=$BINARY_NAME" >> "$GITHUB_ENV" echo "BINARY_NAME=$BINARY_NAME" >> "$GITHUB_ENV"
if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
GCC_PREFIX="aarch64-linux-gnu-" GCC_PREFIX="aarch64-linux-gnu-"
else else
GCC_PREFIX="" GCC_PREFIX=""
@ -149,7 +145,6 @@ jobs:
########## create sha256 ########## ########## create sha256 ##########
if [[ ${{ runner.os }} == 'Windows' ]]; then if [[ ${{ runner.os }} == 'Windows' ]]; then
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256 certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256
else else
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
@ -174,6 +169,46 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# (for older glibc compatibility: https://github.com/alexpasmantier/television/issues/339)
publish-release-legacy-linux:
name: Publishing for Legacy Linux
runs-on: ubuntu-latest
container: centos:7
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
yum -y update
yum -y groupinstall "Development Tools"
yum -y install gcc-c++ glibc-devel glibc-static
- name: Install Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup target add x86_64-unknown-linux-gnu
- name: Cargo build
run: |
cargo build --release --target x86_64-unknown-linux-gnu
- name: Packaging final binary
run: |
cd target/x86_64-unknown-linux-gnu/release
tar czvf tv-legacy-linux.tar.gz tv
- name: Releasing assets
uses: softprops/action-gh-release@v2
with:
files: |
target/x86_64-unknown-linux-gnu/release/tv-legacy-linux.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-release-deb: publish-release-deb:
name: publish-release-deb for ${{ matrix.target }} name: publish-release-deb for ${{ matrix.target }}
runs-on: ubuntu-latest runs-on: ubuntu-latest