1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
|
name: Package
run-name: Package ${{ github.sha }} by @${{ github.actor }}
on:
workflow_dispatch:
permissions:
contents: write
env:
BOOST_VERSION: 1_89_0
SNAPWEB_VERSION: v0.9.2
jobs:
release:
runs-on: ubuntu-latest
name: Create release
outputs:
tag: ${{ steps.draft_release.outputs.tag }}
steps:
- name: Get dependencies
run: sudo apt-get update && sudo apt-get install -yq python3
env:
DEBIAN_FRONTEND: noninteractive
- name: Checkout
uses: actions/checkout@v5
- name: Create release notes
run: $GITHUB_WORKSPACE/extras/changelog_current_version.py $GITHUB_WORKSPACE/changelog.md > $GITHUB_WORKSPACE/changelog_current.md
- name: Create draft release
id: draft_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
URL=$( \
gh release create v0.0.0 \
--draft \
--repo="$GITHUB_REPOSITORY" \
--title="Snapcast v${{ github.sha }}" \
--notes-file changelog_current.md \
)
echo "tag=$(basename $URL)" >> $GITHUB_OUTPUT
deb:
needs: release
strategy:
fail-fast: false
matrix:
debian:
- bullseye
- bookworm
- trixie
arch:
- amd64
- armhf
- arm64
include:
- arch: "amd64"
os: ubuntu-latest
image_prefix: "debian:"
- arch: "armhf"
os: self-hosted-rpi4
image_prefix: "badaix/raspios-lite:"
- arch: "arm64"
os: self-hosted-rpi5
image_prefix: "badaix/raspios-lite:"
runs-on: ${{ matrix.os }}
name: deb (${{ matrix.arch }}, ${{ matrix.debian }})
timeout-minutes: 240
container:
image: ${{matrix.image_prefix}}${{matrix.debian}}
steps:
- name: Get dependencies
run: |
apt-get update && \
apt-get install -yq wget debhelper build-essential cmake git rename \
libatomic1 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev \
libopus-dev alsa-utils libpulse-dev libavahi-client-dev avahi-daemon libexpat1-dev \
libssl-dev libpipewire-0.3-dev python3 ccache unzip debhelper
env:
DEBIAN_FRONTEND: noninteractive
- name: Get GitHub cli
run: |
(type -p wget >/dev/null || (apt update && apt-get install wget -y)) \
&& mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y
- name: Checkout
uses: actions/checkout@v5
- name: Setup environment
run: |
echo "PARENT_DIR=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
BOOST_DOT_VERSION=$(echo ${BOOST_VERSION} | sed 's/_/./g')
echo "BOOST_DOT_VERSION=$BOOST_DOT_VERSION" >> $GITHUB_ENV
echo "BOOST=boost_${BOOST_VERSION}" >> $GITHUB_ENV
ln -s extras/package/debian debian
- name: Create changelog
run: |
$GITHUB_WORKSPACE/debian/changelog_md2deb.py $GITHUB_WORKSPACE/changelog.md > $GITHUB_WORKSPACE/debian/changelog
cat $GITHUB_WORKSPACE/debian/changelog
- name: Clean up
run: rm -rf ${{env.PARENT_DIR}}/snap*_*.deb
- name: Cache boost
id: cache-boost
uses: actions/cache@v4
with:
path: ${{env.BOOST}}
key: ${{env.BOOST}}
- name: Get boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
wget https://archives.boost.io/release/${{env.BOOST_DOT_VERSION}}/source/${{env.BOOST}}.tar.bz2
tar xjf ${{env.BOOST}}.tar.bz2
- name: cache ccache
id: cache-ccache
uses: actions/cache@v4
with:
# TODO: use environment variable $HOME/.ccache
path: /home/runner/.ccache
key: ${{ matrix.os }}-${{ matrix.debian }}-ccache-${{ github.sha }}
restore-keys: ${{ matrix.os }}-${{ matrix.debian }}-ccache-
- name: Get Snapweb
run: |
wget https://github.com/badaix/snapweb/releases/download/${SNAPWEB_VERSION}/snapweb.zip
unzip snapweb.zip -d snapweb
- name: Create deb package
env:
# TODO: use environment variable $HOME/.ccache
CCACHE_DIR: /home/runner/.ccache
run: |
fakeroot make -f debian/rules CMAKEFLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE:STRING=Release -DREVISION=${{ github.sha }} -DSNAPWEB_DIR:STRING=$GITHUB_WORKSPACE/snapweb" binary
rename 's/_${{ matrix.arch }}/_${{ matrix.arch }}_${{ matrix.debian }}/g' ../snap*_${{ matrix.arch }}.deb
fakeroot make -f debian/rules clean
fakeroot make -f debian/rules CMAKEFLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE:STRING=Release -DREVISION=${{ github.sha }} -DBUILD_WITH_PULSE=ON -DSNAPWEB_DIR:STRING=$GITHUB_WORKSPACE/snapweb" binary
rm ../snapserver_*_${{ matrix.arch }}.deb
rename 's/_${{ matrix.arch }}/_${{ matrix.arch }}_${{ matrix.debian }}_with-pulse/g' ../snap*_${{ matrix.arch }}.deb
fakeroot make -f debian/rules clean
fakeroot make -f debian/rules CMAKEFLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE:STRING=Release -DREVISION=${{ github.sha }} -DBUILD_WITH_PIPEWIRE=ON -DSNAPWEB_DIR:STRING=$GITHUB_WORKSPACE/snapweb" binary
rename 's/_${{ matrix.arch }}/_${{ matrix.arch }}_${{ matrix.debian }}_with-pipewire/g' ../snap*_${{ matrix.arch }}.deb
- name: Release artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
gh release upload ${{needs.release.outputs.tag}} ${{env.PARENT_DIR}}/snap*_*.deb
win:
needs: release
runs-on: windows-2022
name: win
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Checkout Snapcast
uses: actions/checkout@v5
with:
repository: badaix/snapcast
path: src/snapcast
ref: ${{ env.VERSION }}
- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
#path: ${VCPKG_INSTALLATION_ROOT}\installed
path: c:\vcpkg\installed
key: ${{ runner.os }}-dependencies
- name: Get dependenciesenv
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: vcpkg.exe install libflac libvorbis soxr opus openssl boost-asio boost-beast --triplet x64-windows
- name: configure
run: |
echo vcpkg installation root: $env:VCPKG_INSTALLATION_ROOT
cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="x64-windows" -DCMAKE_BUILD_TYPE="Release" -DREVISION="${{ github.sha }}" -DWERROR=ON
- name: build
run: cmake --build build --config Release --parallel 3 --verbose
- name: installer
run: |
mkdir bundle
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\FLAC.dll bundle\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\ogg.dll bundle\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\opus.dll bundle\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\vorbis.dll bundle\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\soxr.dll bundle\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\libcrypto-3-x64.dll bundle\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\libssl-3-x64.dll bundle\
copy "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\v143\vc_redist.x64.exe" bundle\
copy bin\Release\snapclient.exe bundle\
Compress-Archive -Path bundle\* -Destination snapclient_win64.zip
- name: Release artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global --add safe.directory .
gh release upload ${{needs.release.outputs.tag}} snapclient_win64.zip
# mac:
# strategy:
# fail-fast: false
# matrix:
# xcode: ['11']
# runs-on: macos-latest
# name: mac (xcode ${{ matrix.xcode }})
# steps:
# - name: Checkout
# uses: actions/checkout@v5
# - name: Checkout Snapcast
# uses: actions/checkout@v5
# with:
# repository: badaix/snapcast
# path: src/snapcast
# ref: ${{ env.VERSION }}
# - name: Setup environment
# run: |
# BOOST_DOT_VERSION=$(echo ${BOOST_VERSION} | sed 's/_/./g')
# echo "BOOST_DOT_VERSION=$BOOST_DOT_VERSION" >> $GITHUB_ENV
# echo "BOOST=boost_${BOOST_VERSION}" >> $GITHUB_ENV
# - name: Get dependencies
# run: brew install pkgconfig libsoxr ccache expat
# - name: Cache boost
# id: cache-boost
# uses: actions/cache@v4
# with:
# path: ${{env.BOOST}}
# key: ${{ runner.os }}-boost
# - name: Get boost
# if: steps.cache-boost.outputs.cache-hit != 'true'
# run: |
# wget https://boostorg.jfrog.io/artifactory/main/release/${{env.BOOST_DOT_VERSION}}/source/${{env.BOOST}}.tar.bz2
# tar xjf ${{env.BOOST}}.tar.bz2
# - name: Cache ccache
# id: cache-ccache
# uses: actions/cache@v4
# with:
# path: /Users/runner/.ccache
# key: ${{ runner.os }}-ccache-${{ github.sha }}
# restore-keys: ${{ runner.os }}-ccache-
# #- name: ccache dump config
# # run: ccache -p
# - name: configure
# run: cmake -S $GITHUB_WORKSPACE/src/snapcast -B build -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE=Release -DREVISION=${{ github.sha }} -DWERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS="-I/usr/local/include -Wno-deprecated-declarations"
# - name: build
# run: cmake --build build --parallel 3
# rpm:
# if: ${{ false }} # disable for now
# strategy:
# fail-fast: false
# matrix:
# image:
# - 34
# - 35
# os:
# - ubuntu-latest
# - self-hosted-rpi4
# include:
# - os: ubuntu-latest
# arch: "x86_64"
# - os: self-hosted-rpi4
# arch: "armv7hl"
# runs-on: ${{ matrix.os }}
# name: rpm (${{ matrix.arch }}, fedora ${{ matrix.image }})
# container:
# image: fedora:${{matrix.image}}
# steps:
# - name: Get dependencies
# run: dnf -y update && dnf -y install wget git rpm-build gcc-c++ cmake boost-devel alsa-lib-devel avahi-devel libatomic libvorbis-devel opus-devel pulseaudio-libs-devel flac-devel soxr-devel libstdc++-static expat-devel
# - name: Checkout
# uses: actions/checkout@v5
# - name: Checkout Snapcast
# uses: actions/checkout@v5
# with:
# repository: badaix/snapcast
# path: src/snapcast
# ref: ${{ env.VERSION }}
# - name: Create rpm package
# run: |
# mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
# cp rpm/* ~/rpmbuild/SOURCES/
# tar -C $GITHUB_WORKSPACE/src/ -czvf ~/rpmbuild/SOURCES/snapcast.tar.gz snapcast
# rpmbuild --nodebuginfo --define '_reversion ${{ github.sha }}' --define '_version ${{ env.VERSION }}' -bb ~/rpmbuild/SOURCES/snapcast.spec
# - name: Archive artifacts
# uses: actions/upload-artifact@v4
# with:
# name: snapcast_${{ matrix.arch }}-fedora-${{matrix.image}}-${{ github.sha }}
# path: ~/rpmbuild/RPMS/${{ matrix.arch }}/snap*.rpm
|