Add justfile for native and container workflows
Expose native build, run, install, check, test, probe and smoke recipes. Build the OCI image before container launch or desktop installation, and document optional just usage.
This commit is contained in:
1 parent
2104bbaf3b
commit
0760d7ba6c
2 files changed
+91
No files matched your search
@@ -124,6 +124,27 @@ avoid a dependency and a move to `AdwApplication`.
|
||||
|
||||
## Building
|
||||
|
||||
### Task runner (optional)
|
||||
|
||||
With [just](https://just.systems) installed, run `just` to list the available
|
||||
recipes:
|
||||
|
||||
```sh
|
||||
just # show commands; does not build or install anything
|
||||
just build # native release build
|
||||
just run # build and run the native GUI
|
||||
just test # portable model and container/desktop tests
|
||||
just check # native type-check and MoonBit formatting check
|
||||
just install # build and install the native app for your user
|
||||
just container-install # build the OCI image and install its desktop launcher
|
||||
just container-run # build and run the OCI image without installing it
|
||||
```
|
||||
|
||||
There are also `fmt`, `probe`, `test-container` and `smoke [prefix]`
|
||||
recipes. Native installation respects `XDG_DATA_HOME`; container recipes
|
||||
respect `MOONMIX_IMAGE`. The equivalent commands and dependencies are
|
||||
documented below.
|
||||
|
||||
### Dependencies
|
||||
|
||||
You need MoonBit (`curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash`,
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
set shell := ["sh", "-eu", "-c"]
|
||||
|
||||
# List available recipes.
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# Build the native release binaries.
|
||||
build:
|
||||
moon build --target native --release
|
||||
|
||||
# Build and run the native GUI.
|
||||
run: build
|
||||
./_build/native/release/build/cmd/moonmix/moonmix.exe
|
||||
|
||||
# Build and install the native app, desktop entry and icons for your user.
|
||||
install: build
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
data_home=${XDG_DATA_HOME:-"$HOME/.local/share"}
|
||||
install -Dm755 _build/native/release/build/cmd/moonmix/moonmix.exe "$HOME/.local/bin/moonmix"
|
||||
install -Dm644 data/org.latha.moonmix.desktop "$data_home/applications/org.latha.moonmix.desktop"
|
||||
install -Dm644 data/icons/hicolor/scalable/apps/org.latha.moonmix.svg "$data_home/icons/hicolor/scalable/apps/org.latha.moonmix.svg"
|
||||
install -Dm644 data/icons/hicolor/symbolic/apps/org.latha.moonmix-symbolic.svg "$data_home/icons/hicolor/symbolic/apps/org.latha.moonmix-symbolic.svg"
|
||||
install -Dm644 -t "$data_home/icons/hicolor/scalable/actions" data/icons/hicolor/scalable/actions/moonmix-*.svg
|
||||
install -Dm644 data/icons/LICENSE.lucide "$data_home/doc/moonmix/LICENSE.lucide"
|
||||
if command -v gtk-update-icon-cache >/dev/null 2>&1; then
|
||||
gtk-update-icon-cache -f -t "$data_home/icons/hicolor"
|
||||
fi
|
||||
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||
update-desktop-database "$data_home/applications"
|
||||
fi
|
||||
|
||||
# Type-check all native packages and check MoonBit formatting.
|
||||
check:
|
||||
moon check --target native
|
||||
moon fmt --check
|
||||
|
||||
# Format the MoonBit sources.
|
||||
fmt:
|
||||
moon fmt
|
||||
|
||||
# Run the portable model tests and container/desktop packaging tests.
|
||||
test: test-container
|
||||
moon test --target wasm-gc
|
||||
|
||||
# Test the container runner and installer without building an image.
|
||||
test-container:
|
||||
python3 tools/test-container.py
|
||||
|
||||
# Build and print the current audio graph without changing it.
|
||||
probe: build
|
||||
./_build/native/release/build/cmd/moonmix-probe/moonmix-probe.exe
|
||||
|
||||
# Build debug binaries and run the private audio/GUI smoke test.
|
||||
smoke prefix="_build/screenshots/moonmix":
|
||||
moon build --target native
|
||||
mkdir -p "$(dirname -- {{ quote(prefix) }})"
|
||||
tools/smoke-test.sh {{ quote(prefix) }}
|
||||
|
||||
# Build the local OCI image (override its tag with MOONMIX_IMAGE).
|
||||
container-build:
|
||||
podman build --format=oci -t "${MOONMIX_IMAGE:-localhost/moonmix:latest}" .
|
||||
|
||||
# Build and run the OCI image using the checkout's current launcher.
|
||||
container-run: container-build
|
||||
./tools/moonmix-container
|
||||
|
||||
# Build the OCI image and install its per-user desktop launcher.
|
||||
container-install: container-build
|
||||
python3 tools/install-container.py
|
||||
Reference in new issue
Block a user