Files
Michel de Graaf 4c5a808762 build(nix): add a flake
nix run github:michel/soulseek-rs/master builds the release branch and
/develop the nightly. The lock is not optional: without one nix refuses
a github: reference outright and hides the commit from the build, so
the version stamp read +dirty.
2026-09-21 12:58:09 +02:00

88 lines
2.5 KiB
YAML

name: Packaging
on:
pull_request:
paths:
- 'flake.nix'
- 'flake.lock'
- 'Cargo.lock'
- 'Cargo.toml'
- 'packaging/**'
- 'scripts/package-linux.sh'
- 'soulseek-rs/src/cli.rs'
- 'soulseek-rs/src/run.rs'
- 'soulseek-rs/src/commands/**'
- '.github/workflows/packaging.yml'
permissions:
contents: read
concurrency:
group: packaging-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
VERSION: 0.0.0+git202601010000.0000000
jobs:
packages:
name: .deb and .rpm
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
- name: Install musl toolchain
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build the packages
env:
SOULSEEK_RS_VERSION: ${{ env.VERSION }}
TARGET: x86_64-unknown-linux-musl
run: |
cargo build --locked --release --target "$TARGET" --package soulseek-rs
sh scripts/package-linux.sh "target/$TARGET/release/soulseek-rs" "$VERSION" "$TARGET" . soulseek-rs-nightly
- name: Install the .deb
run: |
sudo apt-get install -y ./soulseek-rs-nightly-amd64.deb
soulseek-rs --version | grep -F "$VERSION"
dpkg -L soulseek-rs | grep -Fx /usr/share/man/man1/soulseek-rs.1.gz
dpkg -L soulseek-rs | grep -Fx /usr/share/zsh/vendor-completions/_soulseek-rs
- name: Install the .rpm
run: |
docker run --rm -v "$PWD:/packages:ro" fedora:latest sh -ec "
dnf install -y /packages/soulseek-rs-nightly-x86_64.rpm
soulseek-rs --version | grep -F '$VERSION'
rpm -ql soulseek-rs | grep -Fx /usr/share/man/man1/soulseek-rs.1.gz
rpm -ql soulseek-rs | grep -Fx /usr/share/zsh/site-functions/_soulseek-rs
"
flake:
name: Nix flake
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: cachix/install-nix-action@v31
- name: Build and run
run: |
nix build --print-build-logs
./result/bin/soulseek-rs --version | grep -E '\+git[0-9]{12}\.[0-9a-f]{7}$'
test -s result/share/man/man1/soulseek-rs.1.gz
test -s result/share/fish/vendor_completions.d/soulseek-rs.fish