name: Build permissions: contents: write packages: write on: push: branches: [main, master] pull_request: branches: [main, master] workflow_dispatch: jobs: build-and-package: 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 \ libssl-dev \ pkg-config - name: Checkout code uses: actions/checkout@v7 with: fetch-depth: 0 - name: Setup Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable cache: false - name: Rust Cache uses: swatinem/rust-cache@v2 with: prefix-key: "v3-${{ matrix.runner }}" - name: Run tests run: cargo test --locked - name: Build all binaries run: cargo build --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<> $GITHUB_OUTPUT echo "$BIN_NAMES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - name: Package ZIP 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/debug/$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 zip -j "$ARCHIVE_NAME" "${FILES[@]}" - name: Upload ZIP artifact uses: actions/upload-artifact@v7 with: name: archive-${{ matrix.arch }} path: pwsp-*.zip retention-days: 7 - name: Cache cargo-deb id: cache-cargo-deb uses: actions/cache@v6 with: path: ~/.cargo/bin/cargo-deb key: ${{ runner.os }}-${{ runner.arch }}-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 shell: bash run: | set -euo pipefail export PATH="$HOME/.cargo/bin:$PATH" if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]; then BASE_VERSION=$(grep '^version =' Cargo.toml | head -1 | cut -d'"' -f2) GIT_REV=$(git rev-parse --short HEAD) DATE=$(date +%Y%m%d) DEB_VER="${BASE_VERSION}+git${DATE}.${GIT_REV}" echo "Building nightly deb version: $DEB_VER" cargo-deb -p pwsp-gui --no-build --no-strip --profile dev --deb-version "$DEB_VER" else cargo-deb -p pwsp-gui --no-build --no-strip --profile dev fi - name: Upload .deb artifact uses: actions/upload-artifact@v7 with: name: deb-packages-${{ matrix.arch }} path: target/debian/*.deb retention-days: 7 deploy-nightly-apt: needs: build-and-package if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest concurrency: gh-pages-deploy permissions: contents: write steps: - name: Checkout code uses: actions/checkout@v7 - name: Setup GPG id: gpg uses: crazy-max/ghaction-import-gpg@v7 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} passphrase: ${{ secrets.GPG_PASSPHRASE }} - name: Download DEB artifacts uses: actions/download-artifact@v8 with: pattern: deb-packages-* path: debs merge-multiple: true - name: Checkout existing gh-pages uses: actions/checkout@v7 with: ref: gh-pages path: gh-pages-branch continue-on-error: true - name: Generate Nightly APT Repository run: | sudo apt-get update sudo apt-get install -y reprepro mkdir -p apt-repo if [ -d "gh-pages-branch/apt" ]; then cp -r gh-pages-branch/apt/* apt-repo/ || true fi mkdir -p apt-repo/conf cat < apt-repo/conf/distributions Origin: arabianq Label: PipeWire Soundpad Codename: stable Architectures: amd64 arm64 Components: main Description: APT Repository for PWSP SignWith: ${{ steps.gpg.outputs.fingerprint }} Origin: arabianq Label: PipeWire Soundpad Codename: nightly Architectures: amd64 arm64 Components: main Description: Nightly APT Repository for PWSP SignWith: ${{ steps.gpg.outputs.fingerprint }} EOF gpg --armor --export ${{ steps.gpg.outputs.fingerprint }} > apt-repo/pubkey.gpg cd apt-repo for deb in ../debs/*.deb; do if [ -f "$deb" ]; then echo "Adding $deb to nightly APT repository..." reprepro includedeb nightly "$deb" fi done - name: Deploy APT Repo to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./apt-repo destination_dir: apt keep_files: true 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@v7 - 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 }} trigger-copr-nightly: if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Install copr-cli run: pip install copr-cli - name: Trigger Copr Build env: COPR_CONFIG: ${{ secrets.COPR_CONFIG }} run: | mkdir -p ~/.config echo "$COPR_CONFIG" > ~/.config/copr copr-cli buildscm --nowait \ --clone-url https://github.com/arabianq/pipewire-soundpad.git \ --commit ${{ github.sha }} \ --spec packages/rpm/pwsp-git.spec \ arabianq/pwsp