Skip to content

fix(release_ci): install libx11 #48

fix(release_ci): install libx11

fix(release_ci): install libx11 #48

Workflow file for this run

# The way this works is the following:
#
# The get-release job fetches the upload_url for the following job.
#
# The build-release job runs only once create-release is finished. It gets the
# release upload URL from create-release job outputs, then builds the release
# executables for each supported platform and attaches them as release assets
# to the previously created release.
name: Release
env:
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
MSRV_FEATURES: --no-default-features --features minimal-application,bugreport,build-assets
on:
push:
# Enable when testing release infrastructure on a branch.
branches:
- fix/release-ci-after-voice
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
jobs:
get-release:
name: get-release
runs-on: ubuntu-latest
# env:
# # Set to force version number, e.g., when no tag exists.
# SMARTCAT_VERSION: TEST-0.0.0
outputs:
smartcat_version: ${{ env.SMARTCAT_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Get the release version from the tag
shell: bash
if: env.SMARTCAT_VERSION == ''
run: |
echo "SMARTCAT_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
echo "version is: ${{ env.SMARTCAT_VERSION }}"
build-release:
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
needs:
- get-release
strategy:
fail-fast: false
matrix:
job:
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true }
- { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
- { target: i686-pc-windows-msvc , os: windows-2019 }
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
- { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
- { target: x86_64-apple-darwin , os: macos-12 }
- { target: x86_64-pc-windows-gnu , os: windows-2019 }
- { target: x86_64-pc-windows-msvc , os: windows-2019 }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
env:
BUILD_CMD: cargo
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install prerequisites
shell: bash
run: |
case ${{ matrix.job.target }} in
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf libx11-dev ;;
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu libx11-dev ;;
esac
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
- name: Install cross
if: matrix.job.use-cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
- name: Show version information (Rust, cargo, GCC)
shell: bash
run: |
gcc --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V
- name: Build
shell: bash
run: $BUILD_CMD build --release --target=${{ matrix.job.target }}
- name: Set binary name & path
id: bin
shell: bash
run: |
# Figure out suffix of binary
EXE_SUFFIX=""
case ${{ matrix.job.target }} in
*-pc-windows-*) EXE_SUFFIX=".exe" ;;
esac;
# Setup paths
BIN_NAME="sc${EXE_SUFFIX}"
BIN_PATH="target/${{ matrix.job.target }}/release/${BIN_NAME}"
# Let subsequent steps know where to find the binary
echo "BIN_PATH=${BIN_PATH}" | tee -a $GITHUB_OUTPUT
echo "BIN_NAME=${BIN_NAME}" | tee -a $GITHUB_OUTPUT
- name: Build archive
id: package
shell: bash
run: |
PKG_SUFFIX=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_SUFFIX=".zip" ;; esac;
PKG_BASENAME="sc-${{ needs.crate-metadata.outputs.version }}-${{ matrix.job.target }}"
PKG_NAME=${PKG_BASENAME}${PKG_SUFFIX}
echo "PKG_NAME=${PKG_NAME}" | tee -a $GITHUB_OUTPUT
PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package"
ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/"
mkdir -p "${ARCHIVE_DIR}"
# Binary
cp "${{ steps.bin.outputs.BIN_PATH }}" "$ARCHIVE_DIR"
# README, LICENSE and CHANGELOG files
cp "README.md" "LICENSE" "$ARCHIVE_DIR"
# base compressed package
pushd "${PKG_STAGING}/" >/dev/null
case ${{ matrix.job.target }} in
*-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;;
*) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;;
esac;
popd >/dev/null
# sha
pushd "${PKG_STAGING}/" >/dev/null
case ${{ matrix.job.target }} in
*-pc-windows-*) certutil -hashfile "${PKG_NAME}" SHA256 > "${PKG_NAME}.sha256" ;;
*) shasum -a 256 "${PKG_NAME}" > "${PKG_NAME}.sha256" ;;
esac;
popd >/dev/null
# Let subsequent steps know where to find the compressed package
echo "ASSET_PATH=${PKG_STAGING}/${PKG_NAME}" | tee -a $GITHUB_ENV
echo "ASSET_SUM=${PKG_STAGING}/${PKG_NAME}.sha256" | tee -a $GITHUB_ENV
- name: Upload release archive
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ needs.get-release.outputs.smartcat_version }} ${{ env.ASSET_PATH }} ${{ env.ASSET_SUM }}