🎉 live server seems to be working now

This commit is contained in:
2026-05-14 14:29:57 +02:00
commit d72e439fd9
181 changed files with 47406 additions and 0 deletions

View File

@@ -0,0 +1,159 @@
# ABOUTME: CI workflow for pull requests and main branch pushes
# ABOUTME: Tests on Linux, builds player + server on Linux/macOS/Windows
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Tell every `go` invocation across every job to drop the libopusfile parts of
# gopkg.in/hraban/opus.v2. Our code never calls the opus.Stream API, and the
# tag lets us skip installing libopusfile-dev / opusfile / mingw-w64-x86_64-opusfile
# on the runners and lets the released binary not depend on libopusfile0 at runtime.
env:
GOFLAGS: -tags=nolibopusfile
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopus-dev libasound2-dev
- name: Run tests
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
fail_ci_if_error: false
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopus-dev libasound2-dev shellcheck
- name: Shellcheck
run: shellcheck scripts/*.sh install-deps.sh
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m
build:
name: Build ${{ matrix.os }}/${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- os: linux
arch: amd64
runner: ubuntu-latest
ext: ""
- os: linux
arch: arm64
runner: ubuntu-24.04-arm
ext: ""
- os: darwin
arch: arm64
runner: macos-latest
ext: ""
- os: windows
arch: amd64
runner: windows-latest
ext: ".exe"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.24'
# Linux dependencies
- name: Install dependencies (Linux)
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libopus-dev libasound2-dev
# macOS dependencies
- name: Install dependencies (macOS)
if: matrix.os == 'darwin'
run: brew install opus
# Windows dependencies via MSYS2
- name: Install dependencies (Windows)
if: matrix.os == 'windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-opus
- name: Get version
id: version
shell: bash
run: echo "VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo dev)" >> $GITHUB_OUTPUT
# Linux + macOS build
- name: Build (Unix)
if: matrix.os != 'windows'
env:
CGO_ENABLED: "1"
run: |
LDFLAGS="-X github.com/Sendspin/sendspin-go/internal/version.Version=${{ steps.version.outputs.VERSION }}"
go build -ldflags "${LDFLAGS}" -o sendspin-player-${{ matrix.os }}-${{ matrix.arch }} .
go build -ldflags "${LDFLAGS}" -o sendspin-server-${{ matrix.os }}-${{ matrix.arch }} ./cmd/sendspin-server
# Windows build — needs MSYS2 MinGW on PATH for CGO
- name: Build (Windows)
if: matrix.os == 'windows'
shell: cmd
run: |
set PATH=D:\a\_temp\msys64\mingw64\bin;%PATH%
set CGO_ENABLED=1
set CC=gcc
set LDFLAGS=-X github.com/Sendspin/sendspin-go/internal/version.Version=${{ steps.version.outputs.VERSION }}
go build -ldflags "%LDFLAGS%" -o sendspin-player-windows-amd64.exe .
go build -ldflags "%LDFLAGS%" -o sendspin-server-windows-amd64.exe .\cmd\sendspin-server
- name: Upload player
uses: actions/upload-artifact@v4
with:
name: sendspin-player-${{ matrix.os }}-${{ matrix.arch }}
path: sendspin-player-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
- name: Upload server
uses: actions/upload-artifact@v4
with:
name: sendspin-server-${{ matrix.os }}-${{ matrix.arch }}
path: sendspin-server-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}

View File

@@ -0,0 +1,96 @@
# ABOUTME: Runs the Sendspin protocol conformance suite against this PR
# ABOUTME: Pins sendspin-go to the PR checkout via CONFORMANCE_REPO_SENDSPIN_GO env var
name: Conformance
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: conformance-${{ github.ref }}
cancel-in-progress: true
# Match ci.yml / release.yml — the conformance harness invokes `go build`
# under the hood when it spins up the sendspin-go adapter, and we want
# that build to skip libopusfile linking the same way the released
# binaries do.
env:
GOFLAGS: -tags=nolibopusfile
jobs:
conformance:
name: Protocol conformance
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout sendspin-go
uses: actions/checkout@v4
with:
path: sendspin-go
- name: Checkout conformance harness
uses: actions/checkout@v4
with:
repository: Sendspin/conformance
path: conformance
ref: main
- name: Clone aiosendspin (reference peer)
run: |
git clone --depth 1 https://github.com/Sendspin/aiosendspin.git \
conformance/repos/aiosendspin
- name: Clone sendspin-cli (supplies the FLAC test fixture)
run: |
git clone --depth 1 https://github.com/Sendspin/sendspin-cli.git \
conformance/repos/sendspin-cli
- name: Pin sendspin-go adapter at the PR checkout
run: |
mkdir -p conformance/repos
ln -sfn ${{ github.workspace }}/sendspin-go conformance/repos/sendspin-go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
python-version: '3.12'
- name: Install harness dependencies
working-directory: conformance
run: uv sync
- name: Run conformance scenarios
working-directory: conformance
env:
CONFORMANCE_REPO_SENDSPIN_GO: ${{ github.workspace }}/sendspin-go
run: |
uv run python scripts/run_all.py \
--from sendspin-go \
--to aiosendspin,sendspin-go \
--results-dir results/ \
--environment-id sendspin-go-ci \
--environment-name "sendspin-go CI (${{ github.ref_name }})"
- name: Detect regressions against published baseline
working-directory: conformance
run: |
uv run python scripts/detect_regressions.py \
--results-dir results/ \
--github-summary
- name: Upload conformance report
if: always()
uses: actions/upload-artifact@v4
with:
name: conformance-report
path: conformance/results/
retention-days: 30

View File

@@ -0,0 +1,196 @@
# ABOUTME: Release workflow triggered by version tags
# ABOUTME: Builds player + server for Linux/macOS/Windows and creates GitHub release
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
# Drop the libopusfile parts of gopkg.in/hraban/opus.v2 so the released
# binary doesn't link libopusfile.so.0 / opusfile.dylib at runtime. We
# never call the opus.Stream API. See ci.yml for the same setup.
env:
GOFLAGS: -tags=nolibopusfile
jobs:
test:
name: Test Before Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopus-dev libasound2-dev
- name: Run tests
run: go test -v -race ./...
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m
build:
name: Build ${{ matrix.os }}/${{ matrix.arch }}
needs: test
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- os: linux
arch: amd64
runner: ubuntu-latest
ext: ""
- os: linux
arch: arm64
runner: ubuntu-24.04-arm
ext: ""
- os: darwin
arch: arm64
runner: macos-latest
ext: ""
- os: windows
arch: amd64
runner: windows-latest
ext: ".exe"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install dependencies (Linux)
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libopus-dev libasound2-dev
- name: Install dependencies (macOS)
if: matrix.os == 'darwin'
run: brew install opus
- name: Install dependencies (Windows)
if: matrix.os == 'windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-opus
- name: Get version
id: version
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build (Unix)
if: matrix.os != 'windows'
env:
CGO_ENABLED: "1"
run: |
LDFLAGS="-X github.com/Sendspin/sendspin-go/internal/version.Version=${{ steps.version.outputs.VERSION }} -s -w"
go build -ldflags "${LDFLAGS}" -o sendspin-player-${{ matrix.os }}-${{ matrix.arch }} .
go build -ldflags "${LDFLAGS}" -o sendspin-server-${{ matrix.os }}-${{ matrix.arch }} ./cmd/sendspin-server
- name: Build (Windows)
if: matrix.os == 'windows'
shell: cmd
run: |
set PATH=D:\a\_temp\msys64\mingw64\bin;%PATH%
set CGO_ENABLED=1
set CC=gcc
set LDFLAGS=-X github.com/Sendspin/sendspin-go/internal/version.Version=${{ steps.version.outputs.VERSION }} -s -w
go build -ldflags "%LDFLAGS%" -o sendspin-player-windows-amd64.exe .
go build -ldflags "%LDFLAGS%" -o sendspin-server-windows-amd64.exe .\cmd\sendspin-server
- name: Create archives (Unix)
if: matrix.os != 'windows'
run: |
tar czf sendspin-player-${{ matrix.os }}-${{ matrix.arch }}.tar.gz sendspin-player-${{ matrix.os }}-${{ matrix.arch }}
tar czf sendspin-server-${{ matrix.os }}-${{ matrix.arch }}.tar.gz sendspin-server-${{ matrix.os }}-${{ matrix.arch }}
- name: Create archives (Windows)
if: matrix.os == 'windows'
shell: bash
run: |
7z a sendspin-player-windows-amd64.zip sendspin-player-windows-amd64.exe
7z a sendspin-server-windows-amd64.zip sendspin-server-windows-amd64.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}-${{ matrix.arch }}
path: |
sendspin-player-${{ matrix.os }}-${{ matrix.arch }}.*
sendspin-server-${{ matrix.os }}-${{ matrix.arch }}.*
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: release-*
merge-multiple: true
- name: List artifacts
run: ls -lh artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: ${{ steps.version.outputs.VERSION }}
body: |
## Sendspin ${{ steps.version.outputs.VERSION }}
### Downloads
| Platform | Player | Server |
|----------|--------|--------|
| Linux x86_64 | `sendspin-player-linux-amd64.tar.gz` | `sendspin-server-linux-amd64.tar.gz` |
| Linux ARM64 | `sendspin-player-linux-arm64.tar.gz` | `sendspin-server-linux-arm64.tar.gz` |
| macOS Apple Silicon | `sendspin-player-darwin-arm64.tar.gz` | `sendspin-server-darwin-arm64.tar.gz` |
| Windows x86_64 | `sendspin-player-windows-amd64.zip` | `sendspin-server-windows-amd64.zip` |
### Daemon mode (Linux)
```bash
tar xzf sendspin-player-linux-amd64.tar.gz
sudo install -m 755 sendspin-player-linux-amd64 /usr/local/bin/sendspin-player
# Copy the systemd unit from dist/systemd/ in the source repo, then:
sudo systemctl enable --now sendspin-player
```
files: artifacts/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}