Skip to content

arm64

arm64 #112

Workflow file for this run

name: CI
on: [push, pull_request]
defaults:
run:
shell: bash
env:
GST_GIT_REPO: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
GST_GIT_BRANCH: main
RPI_SYSROOT: /rpi-tools/arm-bcm2708/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot
RPI_BIN: /rpi-tools/arm-bcm2708/arm-linux-gnueabihf/bin
jobs:
# This job must run on the runner because hashFiles() operates on the runner
# by design, not inside the defined container (actions/runner#837).
bust-cache:
runs-on: ubuntu-latest
outputs:
container_version: ${{ steps.container.outputs.version }}
spotify_src: ${{ steps.gstsrc.outputs.hash }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Find latest container version
id: container
run: |
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Checkout gst-plugins-rs
run: git clone --depth 1 -b ${{ env.GST_GIT_BRANCH }} ${{ env.GST_GIT_REPO }}
- name: Find latest spotify src commit
id: gstsrc
run: |
echo "hash=$(git -C gst-plugins-rs rev-parse --short HEAD:audio/spotify)" >> $GITHUB_OUTPUT
main:
strategy:
fail-fast: false
matrix:
include:
- target: arm-unknown-linux-gnueabihf
linker: arm-linux-gnueabihf
linker_path: ${RPI_BIN}
extra_rust_flags: -L$RPI_SYSROOT/lib -L$RPI_SYSROOT/usr/lib
- target: aarch64-unknown-linux-gnu
linker: aarch64-linux-gnu
runs-on: ubuntu-20.04
container: ghcr.io/mopidy/gst-plugin-spotify-build:latest
needs: bust-cache
env:
GST_PLUGIN: gst-plugin-spotify
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Checkout gst-plugins-rs
run: |
git clone --depth 1 -b ${{ env.GST_GIT_BRANCH }} ${{ env.GST_GIT_REPO }}
cp gst-plugins-rs/audio/spotify/Cargo.toml Cargo.toml.orig
- name: Cache cargo stuff
env:
CONTAINER_VERSION: gst-plugin-spotify-build:${{ needs.bust-cache.outputs.container_version }}
uses: actions/cache@v3
with:
path: |
~/.cargo
gst-plugins-rs/target/${{ matrix.target }}/release
key: ${{ env.CONTAINER_VERSION }}-${{ matrix.target }}
restore-keys: |
${{ env.CONTAINER_VERSION }}-
- name: Install cargo deb
run: cargo install cargo-deb
- name: Configure environment
run: |
TARGET=${{ matrix.target }}
LINKER=${{ matrix.linker }}
PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH=/usr/lib/${LINKER}/pkgconfig
GST_PLUGINS_DIR=$(pkg-config --variable=pluginsdir gstreamer-1.0)
echo "PKG_CONFIG_ALLOW_CROSS=$PKG_CONFIG_ALLOW_CROSS" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo "GST_PLUGINS_DIR=$GST_PLUGINS_DIR" >> $GITHUB_ENV
echo "TARGET=$TARGET" >> $GITHUB_ENV
echo "LINKER=$LINKER" >> $GITHUB_ENV
- name: Add linker tools to path
if: matrix.linker_path != ''
run: |
LINKER_PATH=$(eval "echo ${{ matrix.linker_path }}")
echo "PATH=$LINKER_PATH:$PATH" >> $GITHUB_ENV
which $LINKER
- name: Configure RUSTFLAGS
run: |
RUSTFLAGS=$(eval "echo -C linker=${LINKER}-gcc ${{ matrix.extra_rust_flags }}")
echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV
- name: Build gst-plugins-rs
run: |
env | sort
cd gst-plugins-rs
cargo build --target=${TARGET} --package ${GST_PLUGIN} --release
- name: Strip binary
run: |
SO_FILE=$(find gst-plugins-rs/target/${TARGET}/release/*.so)
ls -l $SO_FILE
${LINKER}-strip $SO_FILE
ls -l $SO_FILE
- name: Upload lib
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }} lib
path: gst-plugins-rs/target/${{ matrix.target }}/release/*.so
- name: Prepare deb package
run: |
echo "Append package metadata to Cargo.toml"
cat Cargo.toml.orig Cargo.toml.deb > gst-plugins-rs/audio/spotify/Cargo.toml
echo "Fixup target-specific library install path"
sed -i "s@%GST_PLUGINS_DIR%@$GST_PLUGINS_DIR@" gst-plugins-rs/audio/spotify/Cargo.toml
- name: Create deb package
run: |
cd gst-plugins-rs
cargo deb -v --target=${TARGET} --package ${GST_PLUGIN} --no-build
DEB_PATH=$(readlink -m $(find target/${TARGET}/debian/*.deb))
echo "DEB_PATH=$DEB_PATH" >> $GITHUB_ENV
- name: Check deb
run: dpkg-deb --field $DEB_PATH Package Architecture Version Installed-Size
- name: Upload deb
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }} Debian Package
path: ${{ env.DEB_PATH }}