Skip to content

Latest commit

 

History

History
148 lines (100 loc) · 6.31 KB

build.md

File metadata and controls

148 lines (100 loc) · 6.31 KB

Building slskd from Source

Prerequisites

  1. Node.js 22.22.2 or a later version supported by the frontend test dependencies, with pnpm 12.4.1
  2. .NET SDK 11.0

Easy Way

The easiest way to build everything, and the method used in automated builds, is to execute the publish script located in the /bin directory. This is a bash script, so you'll need to run it with a console that can execute bash scripts; any Linux terminal, Windows Subsystem for Linux, or Git Bash (installs with Git on Windows).

Review the options for this script by executing:

./bin/publish --help

You should see something similar to the following:

options:
-h, --help          show help
--no-prebuild       skip build and test
--runtime           a valid RID (https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)
--platform          one of: linux/amd64, linux/arm64, linux/arm/v7.  overrides runtime.
--version           version for the binary. defaults to current git tag+SHA
--output            the output directory.  defaults to ../../dist/<runtime>

The runtime parameter is required, and must be a valid .NET RID. For most users this will be either linux-x64 or win-x64, which will produce a 64 bit executable for Linux or Windows, respectively.

The platform parameter is designed to support multi-architecture Docker builds; if you'd like to author your own Dockerfile, refer to the one in the root of this repo for usage.

Output files will go to the /dist directory unless you specify a different location.

Copy/Pasteable Shortcuts

Windows:

./bin/publish --runtime win-x64

macOS (Intel):

./bin/publish --runtime osx-x64

macOS (Apple/ARM):

./bin/publish --runtime osx-arm64

Linux (Typical):

./bin/publish --runtime linux-x64

Linux (musl libc distros like Alpine):

./bin/publish --runtime linux-musl-x64

If your platform is missing, review the automated build configuration in the .github directory for more info.


CI/CD Build Process

CI validation and release publication use separate guarded workflows. Code pushes do not automatically publish release artifacts.

Build Triggers

The CI workflow (ci.yml) runs on manual dispatch from main. Its pull_request_target handler is metadata-only and dispatches validation for a trusted owner PR head after the required labels are set; it does not run arbitrary PR code in the target workflow.

CI Validation

Dispatch the CI workflow on main with action=ci. Use runner_pool=public for GitHub-hosted runners or runner_pool=private for private JIT runners. After Build and Test and Nix Package Smoke pass for that exact head, give the run ID to the guarded tag helper to create and push the source tag:

# Main/stable release
scripts/create-release-tag.sh --validation-run <run-id> v2026051218-slskdn.240

# Dev release
scripts/create-release-tag.sh --validation-run <run-id> build-dev-0.24.1.dev.20260512.180000

See memory-bank/decisions/adr-0005-tagging-system.md for tag format details.

Release Builds and Publishers

Creating a tag does not start a release build. After the tag helper succeeds, dispatch Build on Tag from main with action=release, runner_pool=public, and the existing release_tag. Release jobs use GitHub-hosted runners with native OS and architecture labels. For recovery, select only publishers that did not complete; successful artifacts, announcements, and publishers are left alone.

The helper verifies the GitHub target, refuses dirty or unsynced branches, checks the exact-head CI release gate and duplicate tags, then pushes the release tag. After GitHub publishes the release, verify the actual uploaded assets with:

scripts/verify-release-artifacts.sh <tag>

Build Workflows

  • CI Workflow (ci.yml): Manual validation from main; public is the default runner choice, with private JIT available.
  • Build on Tag (build-on-tag.yml): Manually dispatched from main for an existing v*, build-main-*, or build-dev-* tag.

If a stable release already exists but one or more package publishers failed, maintainers can manually run Build on Tag on the current default branch, provide the original v* or build-main-* tag, and select only the failed publisher targets. This recovery path reuses the published release assets and skips rebuilding binaries, creating another release, repeating announcements, and republishing successful targets.

See memory-bank/decisions/adr-0005-tagging-system.md for historical tag format details.

Hard Way

Your best bet will be to review the scripts in the /bin directory, but if your goal is to do this the hard way you've probably seen those and don't trust them for some reason.

slskd is composed of two separate parts; a front-end React project in the /web directory that was bootstrapped with create-react-app, and a .NET project in the /slskd directory that's a fairly basic .NET Web API project. The front-end project is built into a set of static html, css and JavaScript files and the .NET application serves them to clients (and services API requests).

By default, the .NET project expects the static content to reside in the wwwroot directory beside the executable, but this can be changed in the configuration. ./bin/build and ./bin/publish already build src/web, copy src/web/build/* into src/slskd/wwwroot, and include that wwwroot in the published output. A standalone pnpm --filter @slskdn/web build only refreshes src/web/build; it does not update the backend-served bundle by itself.

Assuming you are intentionally doing the steps by hand, you'll need to:

  1. Build the React application from the repository root using pnpm --filter @slskdn/web build
  2. Publish the .NET application using some variation of dotnet publish
  3. Move the static content from the React application into a wwwroot beside the built slskd executable

Running the executable should create any necessary directories or files. The example configuration won't be copied to the default location unless it is placed in a config directory beside the executable before the first execution.