build audioserve #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build audioserve | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: 'git reference to checkout and build' | |
required: true | |
default: 'master' | |
type: string | |
workflow_call: | |
inputs: | |
ref: | |
description: 'git reference to checkout and build' | |
required: true | |
default: 'master' | |
type: string | |
env: | |
REGISTRY: ghcr.io | |
BUILDER_IMAGE: srd424/audioserve-builder | |
BUILD_TYPE: release | |
BUILDER_TAG: ${{ github.ref_name == 'master' && 'latest' || github.ref_name }} | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: install rustup | |
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
# - name: install binstall | |
# run: | | |
# curl -L --proto '=https' --tlsv1.2 -sSf \ | |
# https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | \ | |
# bash | |
- name: install cross | |
run: cargo install cross | |
- name: checkout audioserve source | |
uses: actions/checkout@v3 | |
with: | |
repository: 'izderadicka/audioserve' | |
path: audioserve-src | |
ref: ${{ inputs.ref }} | |
- name: generate release name | |
id: genrel | |
run: | | |
set -x | |
if [ "${{ inputs.ref }}" = "master" ]; then | |
rev=$(cd audioserve-src && git rev-parse --short HEAD) | |
echo "::set-output name=release_ref::trunk-$rev" | |
echo "::set-output name=release_tag::trunk-${rev}_$(date +%y%m%d%H%M)" | |
else | |
echo "::set-output name=release_ref::${{ inputs.ref }}" | |
echo "::set-output name=release_tag::${{ inputs.ref }}_$(date +%y%m%d%H%M)" | |
fi | |
- name: cache build cache | |
uses: actions/cache@v3 | |
with: | |
path: build | |
key: as1-${{ env.BUILD_TYPE }}-${{ steps.genrel.outputs.release_ref }} | |
restore-keys: | | |
as1-${{ env.BUILD_TYPE }}- | |
as1- | |
as | |
- name: build with cross | |
run: | | |
export OUTPUT_DIR=${{ env.BUILD_TYPE == 'dev' && 'debug' || 'release' }} && \ | |
mkdir -p ./result ./build && \ | |
cd audioserve-src && \ | |
echo -e '[build]\npre-build = [\n "dpkg --add-architecture $CROSS_DEB_ARCH",\n "apt-get update && apt-get --assume-yes install libavformat-dev:$CROSS_DEB_ARCH"\n]' >Cross.toml && \ | |
CARGO_TARGET_DIR=../build/target && \ | |
CARGO_HOME=../build/cargo && \ | |
cross build --target=aarch64-unknown-linux-gnu --profile ${{ env.BUILD_TYPE }} && \ | |
cp -av ../build/target/aarch64-unknown-linux-gnu/${{ env.OUTPUT_DIR }}/audioserve ../result | |
# - name: Docker run | |
# run: | | |
# mkdir -p ./result ./build && \ | |
# docker run -v ${GITHUB_WORKSPACE}/audioserve-src:/src -v $PWD/build:/build \ | |
# -v $PWD/result:/result -v $PWD/fixups:/fixups -e CARGO_PROFILE=${{ env.BUILD_TYPE }} \ | |
# ${{ env.REGISTRY }}/${{ env.BUILDER_IMAGE }}:${{ env.BUILDER_TAG }} | |
- name: zip results | |
run: zip -r audioserve_aarch64.zip result | |
- name: Release zip | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: audioserve_aarch64.zip | |
tag_name: ${{ steps.genrel.outputs.release_tag }} | |
# vim: set ts=2 et: |