mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-06-19 04:03:33 +00:00
199 lines
5.5 KiB
YAML
199 lines
5.5 KiB
YAML
name: Build
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
linux-build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
runner: ubuntu-latest
|
|
- arch: arm64
|
|
runner: ubuntu-24.04-arm
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.runner }}
|
|
|
|
steps:
|
|
- name: Install apt deps (jq/zip + dev-libs)
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
zip jq \
|
|
libpipewire-0.3-dev \
|
|
libclang-dev \
|
|
libasound2-dev \
|
|
libdbus-1-dev \
|
|
pkg-config
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: 1.96.0
|
|
|
|
- name: Run tests
|
|
run: cargo test --locked
|
|
|
|
- name: Build all binaries (debug-speed compilation into target/release)
|
|
env:
|
|
CARGO_PROFILE_RELEASE_OPT_LEVEL: 0
|
|
CARGO_PROFILE_RELEASE_DEBUG: "true"
|
|
CARGO_PROFILE_RELEASE_STRIP: "false"
|
|
CARGO_PROFILE_RELEASE_LTO: "false"
|
|
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 256
|
|
run: cargo build --release --locked
|
|
|
|
- name: Extract all binary names
|
|
id: cargo-meta
|
|
run: |
|
|
set -euo pipefail
|
|
BIN_NAMES=$(cargo metadata --no-deps --format-version 1 \
|
|
| jq -r '.packages[].targets[] | select(.kind[] | contains("bin")) | .name')
|
|
echo "bin_names<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$BIN_NAMES" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Package all binaries into one archive
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
COMMIT_SHA="${{ github.sha }}"
|
|
ARCHIVE_NAME="pwsp-${COMMIT_SHA}-linux-${{ matrix.arch }}.zip"
|
|
echo "Creating archive: $ARCHIVE_NAME"
|
|
|
|
FILES=()
|
|
while IFS= read -r BIN; do
|
|
[ -z "$BIN" ] && continue
|
|
FILES+=("target/release/$BIN")
|
|
done <<< "${{ steps.cargo-meta.outputs.bin_names }}"
|
|
|
|
if [ "${#FILES[@]}" -eq 0 ]; then
|
|
echo "Error: no binaries were discovered via cargo metadata." >&2
|
|
exit 1
|
|
fi
|
|
|
|
for f in "${FILES[@]}"; do
|
|
if [ ! -f "$f" ]; then
|
|
echo "Error: expected binary not found: $f" >&2
|
|
exit 1
|
|
fi
|
|
echo "Will add: $f"
|
|
done
|
|
|
|
zip -j "$ARCHIVE_NAME" "${FILES[@]}"
|
|
|
|
- name: Upload archive as artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: archive-${{ matrix.arch }}
|
|
path: pwsp-*.zip
|
|
retention-days: 7
|
|
|
|
deb-build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
runner: ubuntu-latest
|
|
- arch: arm64
|
|
runner: ubuntu-24.04-arm
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.runner }}
|
|
|
|
steps:
|
|
- name: Install apt deps (dev-libs)
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libpipewire-0.3-dev \
|
|
libclang-dev \
|
|
libasound2-dev \
|
|
libdbus-1-dev \
|
|
pkg-config
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: 1.96.0
|
|
|
|
- name: Build all binaries (debug-speed compilation into target/release)
|
|
env:
|
|
CARGO_PROFILE_RELEASE_OPT_LEVEL: 0
|
|
CARGO_PROFILE_RELEASE_DEBUG: "true"
|
|
CARGO_PROFILE_RELEASE_STRIP: "false"
|
|
CARGO_PROFILE_RELEASE_LTO: "false"
|
|
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 256
|
|
run: cargo build --release --locked
|
|
|
|
- name: Cache cargo-deb
|
|
id: cache-cargo-deb
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cargo/bin/cargo-deb
|
|
key: ${{ runner.os }}-cargo-deb-v1
|
|
|
|
- name: Install cargo-deb
|
|
if: steps.cache-cargo-deb.outputs.cache-hit != 'true'
|
|
run: cargo install --locked cargo-deb
|
|
|
|
- name: Create .deb package (debug binaries from target/release)
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
cargo-deb -p pwsp-gui --no-build --no-strip
|
|
|
|
- name: Upload .deb(s) as artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: deb-packages-${{ matrix.arch }}
|
|
path: target/debian/*.deb
|
|
retention-days: 7
|
|
|
|
flatpak-build:
|
|
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: x86_64
|
|
runner: ubuntu-latest
|
|
- arch: aarch64
|
|
runner: ubuntu-24.04-arm
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.runner }}
|
|
container:
|
|
image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
|
|
options: --privileged
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build Flatpak
|
|
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
|
with:
|
|
bundle: ru.arabianq.pwsp_${{ matrix.arch }}.flatpak
|
|
manifest-path: packages/flatpak/ru.arabianq.pwsp.yaml
|
|
cache: true
|
|
branch: master
|
|
build-bundle: true
|
|
arch: ${{ matrix.arch }}
|