Skip to content

Commit

Permalink
ci(glibc): packaging for older linux distros
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpasmantier committed Feb 7, 2025
1 parent 11e440c commit 30fbd8e
Showing 1 changed file with 54 additions and 19 deletions.
73 changes: 54 additions & 19 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,48 +43,54 @@ jobs:
strategy:
matrix:
include:
# macos x86_64
- os: macos-latest
os-name: macos
target: x86_64-apple-darwin
architecture: x86_64
binary-postfix: ""
binary-name: tv
use-cross: false
# macos arm64
- os: macos-latest
os-name: macos
target: aarch64-apple-darwin
architecture: arm64
binary-postfix: ""
use-cross: false
binary-name: tv
- os: ubuntu-latest
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
binary-postfix: ""
use-cross: false
binary-name: tv
# windows x86_64
- os: windows-latest
os-name: windows
target: x86_64-pc-windows-msvc
architecture: x86_64
binary-postfix: ".exe"
use-cross: false
binary-name: tv
# ubuntu aaarch64
- os: ubuntu-latest
os-name: linux
target: aarch64-unknown-linux-gnu
architecture: arm64
binary-postfix: ""
use-cross: true
binary-name: tv
# ubuntu i686
- os: ubuntu-latest
os-name: linux
target: i686-unknown-linux-gnu
architecture: i686
binary-postfix: ""
use-cross: true
binary-name: tv
# ubuntu 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:
- name: Checkout repository
Expand All @@ -93,46 +99,36 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable

target: ${{ matrix.target }}

profile: minimal
override: true

- uses: Swatinem/rust-cache@v2
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build

use-cross: ${{ matrix.use-cross }}

toolchain: stable

args: --release --target ${{ matrix.target }}


- name: install strip command
shell: bash
run: |
if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
sudo apt update
sudo apt-get install -y binutils-aarch64-linux-gnu
fi
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.target }}/release
####### reduce binary size by removing debug symbols #######
BINARY_NAME=${{ matrix.binary-name }}${{ matrix.binary-postfix }}
echo "BINARY_NAME=$BINARY_NAME" >> "$GITHUB_ENV"
if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
GCC_PREFIX="aarch64-linux-gnu-"
else
GCC_PREFIX=""
Expand All @@ -149,7 +145,6 @@ jobs:
########## create sha256 ##########
if [[ ${{ runner.os }} == 'Windows' ]]; then
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256
else
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
Expand All @@ -174,6 +169,46 @@ jobs:

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:
name: publish-release-deb for ${{ matrix.target }}
runs-on: ubuntu-latest
Expand Down

0 comments on commit 30fbd8e

Please sign in to comment.