Skip to content

Update webapp dependencies #169

Update webapp dependencies

Update webapp dependencies #169

Workflow file for this run

name: Build for Raspberry Pi 3B+
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
permissions:
contents: read
actions: write
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: npm
cache-dependency-path: package-lock.json
- name: NPM install
run: npm ci
- name: Build
run: npm run build
- name: Biome check
run: npm run biome:check
- name: Install build dependencies
run: |
sudo apt update
sudo apt install -y \
build-essential \
pkg-config \
autoconf \
libtool \
wget \
gcc-aarch64-linux-gnu
# For cross compiling we need to manually build both ALSA and PortAudio for arm64.
# Since those dependencies rarely change we can cache it.
- name: Cache ALSA source and build
id: cache_alsa
uses: actions/cache@v5
with:
path: |
build/alsa/alsa-lib-1.2.10
build/alsa/alsa-lib-1.2.10.tar.bz2
build/alsa/alsa-install
key: alsa-lib-1.2.10
- name: Download and build ALSA-lib for aarch64
if: steps.cache_alsa.outputs.cache-hit != 'true'
run: |
mkdir -p build/alsa
cd build/alsa
wget https://www.alsa-project.org/files/pub/lib/alsa-lib-1.2.10.tar.bz2
tar xjf alsa-lib-1.2.10.tar.bz2
cd alsa-lib-1.2.10
./configure --host=aarch64-linux-gnu --prefix=$PWD/../alsa-install --enable-shared --disable-static
make -j$(nproc) || { echo "Make failed"; exit 1; }
echo "Find lib files "
find . -name 'libasound.so*'
# Cache PortAudio source and install dir
- name: Cache PortAudio source and build
id: cache_portaudio
uses: actions/cache@v5
with:
path: |
build/portaudio
build/portaudio-install
build/pa_stable_v190700_20210406.tgz
key: portaudio-190700-20210406
- name: Download and build PortAudio with ALSA support for aarch64
if: steps.cache_portaudio.outputs.cache-hit != 'true'
run: |
mkdir -p build/portaudio
cd build
wget http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz
tar xzf pa_stable_v190700_20210406.tgz
cd portaudio
./configure --host=aarch64-linux-gnu \
--prefix=$PWD/../portaudio-install \
--with-alsa \
--enable-shared \
--disable-static \
CFLAGS="-I$PWD/../alsa/alsa-lib-1.2.10/include" \
LDFLAGS="-L$PWD/../alsa/alsa-lib-1.2.10/src/.libs"
make -j$(nproc)
make install
- name: Build Go binary for arm64
env:
CGO_ENABLED: 1
GOOS: linux
GOARCH: arm64
CC: aarch64-linux-gnu-gcc
PKG_CONFIG_PATH: ${{ github.workspace }}/build/portaudio-install/lib/pkgconfig
LD_LIBRARY_PATH: ${{ github.workspace }}/build/portaudio-install/lib
CGO_CFLAGS: -I${{ github.workspace }}/build/portaudio-install/include -I${{ github.workspace }}/build/alsa/alsa-lib-1.2.10/include
CGO_LDFLAGS: "-L${{ github.workspace }}/build/portaudio-install/lib -L${{ github.workspace }}/build/alsa/alsa-lib-1.2.10/src/.libs -lportaudio -lasound"
run: |
BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)
COMMIT=$(git rev-parse --short HEAD)
go build -v -ldflags "-X main.GitCommit=$COMMIT -X main.BuildTime=$BUILD_TIME" -o wavestreamer ./wavestreamer.go
- name: Upload binary
uses: actions/upload-artifact@v6
with:
name: wavestreamer-arm64
path: wavestreamer