Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ jobs:
- name: Install Qt Quick build dependencies
run: |
sudo apt-get update
sudo apt-get install -y qt6-base-dev qt6-declarative-dev qmake6 zlib1g-dev
sudo apt-get install -y qt6-base-dev qt6-declarative-dev qmake6 libglib2.0-dev libegl-dev \
qml6-module-qtquick-controls qml6-module-qtquick-layouts \
qml6-module-qtquick-templates qml6-module-qttest qml6-module-qtquick-window \
qml6-module-qtqml-workerscript qml6-module-qtquick-dialogs

- name: gofmt
run: |
Expand All @@ -42,8 +45,16 @@ jobs:
- name: go test
run: go test ./...

- name: Viewer protocol tests
run: make test-viewer
# Skipped without KVM (and the rendering test without Wayland):
# hosted runners exercise only the build of these tests.
- name: Display protocol tests
run: make test-display

- name: Terminal emulator tests
run: make test-terminal

- name: GUI backend tests
run: make test-backend

- name: QML UI tests
run: make test-qml
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

# Attaches the portable tarball OmaStore installs (omastore.toml) to the
# GitHub release of every version tag, creating the release if needed.
on:
push:
tags: ["v*"]

permissions:
contents: write

jobs:
tarball:
runs-on: ubuntu-latest
# Built on Arch: omavm-gui links the system's Qt 6, and Omarchy follows
# Arch's. Ubuntu's older Qt would work too, but only by accident.
container: archlinux:latest
steps:
- name: Install build dependencies
run: pacman -Syu --noconfirm --needed base-devel git go qt6-base qt6-declarative glib2 libglvnd github-cli

- uses: actions/checkout@v7

- name: Build
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
go test ./...
make dist VERSION="${GITHUB_REF_NAME#v}"

- name: Upload to the release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1 ||
gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes
gh release upload "$GITHUB_REF_NAME" --clobber \
build/dist/omavm-*-x86_64-linux.tar.gz \
build/dist/omavm-*-x86_64-linux.tar.gz.sha256
53 changes: 41 additions & 12 deletions CLAUDE.md

Large diffs are not rendered by default.

115 changes: 108 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PREFIX ?= $(HOME)/.local

QS_PLUGIN_DIR ?= $(HOME)/.config/omarchy/plugins/dev.omavm.bar

.PHONY: build build-cli build-gui test vet fmt fmt-check check run run-gui clean install uninstall install-quickshell-plugin uninstall-quickshell-plugin test-viewer test-terminal
.PHONY: dist build build-cli build-gui test vet fmt fmt-check check run run-gui clean install uninstall uninstall-environments install-quickshell-plugin uninstall-quickshell-plugin test-display test-terminal test-backend test-qml

build: build-cli build-gui

Expand All @@ -16,19 +16,31 @@ build-gui:
cp build/gui/omavm-gui bin/omavm-gui.new
mv bin/omavm-gui.new bin/omavm-gui

test: test-viewer test-terminal
test: test-display test-terminal test-backend test-qml
go test ./...

test-viewer:
mkdir -p build/viewer-tests
cd build/viewer-tests && qmake6 ../../gui/tests/vncclient_test.pro && $(MAKE)
./build/viewer-tests/vncclient_test
test-display:
mkdir -p build/display-tests
cd build/display-tests && qmake6 ../../gui/tests/displayclient_test.pro && $(MAKE)
./build/display-tests/displayclient_test
cd build/display-tests && qmake6 ../../gui/tests/displayview_test.pro -o Makefile.view && $(MAKE) -f Makefile.view
./build/display-tests/displayview_test

test-terminal:
mkdir -p build/terminal-tests
cd build/terminal-tests && qmake6 ../../gui/tests/terminal_test.pro && $(MAKE)
./build/terminal-tests/terminal_test

test-backend:
mkdir -p build/backend-tests
cd build/backend-tests && qmake6 ../../gui/tests/backend_refresh_test.pro && $(MAKE)
./build/backend-tests/backend_refresh_test

test-qml:
mkdir -p build/qml-tests
cd build/qml-tests && qmake6 ../../gui/tests/qml_test.pro && $(MAKE)
QT_QPA_PLATFORM=offscreen ./build/qml-tests/qml_test

vet:
go vet ./...

Expand All @@ -53,6 +65,30 @@ run-gui: build-cli build-gui
clean:
rm -rf bin build

# Portable release tarball, the asset OmaStore installs (omastore.toml,
# .github/workflows/release.yml): bin/ holds both binaries side by side,
# which is how each finds the other, and data/ sits next to it, where
# internal/desktop looks for the color icons of a run outside /usr. The
# CLI is static; the GUI uses the system's Qt 6.
VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')
DIST_NAME = omavm-$(VERSION)-x86_64-linux

dist: build-gui
@test -n "$(VERSION)" || { echo "set VERSION=x.y.z"; exit 1; }
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o bin/omavm ./cmd/omavm
rm -rf build/dist && mkdir -p build/dist/$(DIST_NAME)
install -Dm755 bin/omavm build/dist/$(DIST_NAME)/bin/omavm
install -Dm755 bin/omavm-gui build/dist/$(DIST_NAME)/bin/omavm-gui
install -Dm644 -t build/dist/$(DIST_NAME)/data/icons/colors data/icons/colors/*.svg
install -Dm644 data/icons/dev.omavm.app.svg build/dist/$(DIST_NAME)/data/icons/dev.omavm.app.svg
install -Dm644 data/dev.omavm.app.desktop build/dist/$(DIST_NAME)/data/dev.omavm.app.desktop
install -Dm644 -t build/dist/$(DIST_NAME) LICENSE README.md
@# Flat: bin/omavm-gui is the path omastore.toml names, with no
@# versioned top directory in front of it.
tar -C build/dist/$(DIST_NAME) -czf build/dist/$(DIST_NAME).tar.gz bin data LICENSE README.md
cd build/dist && sha256sum $(DIST_NAME).tar.gz > $(DIST_NAME).tar.gz.sha256
@echo "build/dist/$(DIST_NAME).tar.gz"

# User-level install (no root): binaries on PATH, a .desktop entry so
# omavm-gui shows up in the app launcher/taskbar with its own icon, icon
# caches refreshed best-effort, and the Quickshell bar-widget plugin
Expand All @@ -65,15 +101,72 @@ install: build install-quickshell-plugin
install -Dm755 bin/omavm-gui $(PREFIX)/bin/omavm-gui
install -Dm644 data/dev.omavm.app.desktop $(PREFIX)/share/applications/dev.omavm.app.desktop
install -Dm644 data/icons/dev.omavm.app.svg $(PREFIX)/share/icons/hicolor/scalable/apps/dev.omavm.app.svg
@# One icon per environment color, for launcher entries and the file
@# manager (internal/desktop's ColorIcon).
install -Dm644 -t $(PREFIX)/share/omavm/icons data/icons/colors/*.svg
-update-desktop-database $(PREFIX)/share/applications 2>/dev/null
-gtk-update-icon-cache $(PREFIX)/share/icons/hicolor 2>/dev/null
@# ~/.local/share/icons/hicolor usually has no index.theme; the cache is
@# optional there (icon lookup works without it), so only refresh it
@# when the theme index exists instead of printing a spurious error.
@if [ -f $(PREFIX)/share/icons/hicolor/index.theme ]; then \
gtk-update-icon-cache -q $(PREFIX)/share/icons/hicolor || true; \
fi

# Removes only the app itself (binaries, launcher entries, icons).
# Environments OmaVM created (Distrobox containers, Machine disks) are
# never touched here — uninstalling the manager must never silently
# destroy a user's containers or virtual disks. If any are still
# registered, this only warns and points at `uninstall-environments`.
uninstall:
@if [ -x "$(PREFIX)/bin/omavm" ]; then \
count=$$("$(PREFIX)/bin/omavm" list --json 2>/dev/null | grep -o '"name"' | wc -l); \
if [ "$$count" -gt 0 ] 2>/dev/null; then \
echo "Note: $$count OmaVM environment(s) still exist and were left untouched."; \
echo "Run 'make uninstall-environments' to remove them too (asks for confirmation)."; \
fi; \
fi
rm -f $(PREFIX)/bin/omavm $(PREFIX)/bin/omavm-gui
rm -f $(PREFIX)/share/applications/dev.omavm.app.desktop
rm -f $(PREFIX)/share/icons/hicolor/scalable/apps/dev.omavm.app.svg
rm -rf $(PREFIX)/share/omavm/icons
@# Per-environment launcher entries would run binaries that are gone;
@# omavm writes them again on the next start after a reinstall.
rm -f $(PREFIX)/share/applications/dev.omavm.env.*.desktop
-update-desktop-database $(PREFIX)/share/applications 2>/dev/null

# Removes every Environment OmaVM still knows about (Boxes and
# Machines) through `omavm remove` — never raw podman/qemu commands
# here, so it gets the exact same Core validation and cleanup a human
# already gets from the CLI (Stop before disk removal for Machines,
# `distrobox rm --force` for Boxes — a Box's container is removed but
# files in the shared home directory are never touched). Deliberately
# separate from `install`/`uninstall`, never chained into either: opt-in
# only. CONFIRM=1 skips the interactive prompt for scripted/CI use.
uninstall-environments: build-cli
@json=$$(./bin/omavm list --json 2>/dev/null); \
if [ -z "$$json" ] || [ "$$json" = "[]" ]; then \
echo "No OmaVM environments found."; \
exit 0; \
fi; \
echo "This will permanently remove:"; \
echo " - Development Boxes: their containers (home directory files are not touched)"; \
echo " - Machines: their virtual disks and every snapshot"; \
echo "Affected environments:"; \
./bin/omavm list | sed 's/^/ /'; \
if [ "$$CONFIRM" != "1" ]; then \
printf "Type 'yes' to remove all of them: "; \
read reply; \
if [ "$$reply" != "yes" ]; then \
echo "Aborted, nothing removed."; \
exit 1; \
fi; \
fi; \
printf '%s' "$$json" | grep -o '"name":"[^"]*"' | sed -E 's/"name":"(.*)"/\1/' | while IFS= read -r name; do \
[ -z "$$name" ] && continue; \
echo "Removing $$name..."; \
./bin/omavm remove "$$name" || exit 1; \
done

# Copies the Omarchy Quickshell bar-widget plugin into place — nothing
# more, and also run as part of `install` above. It deliberately does NOT
# run `omarchy-shell shell rescanPlugins` or `omarchy plugin enable`,
Expand All @@ -82,7 +175,15 @@ uninstall:
# unsandboxed inside the already-live desktop shell, and this target
# respects that — copying the file is harmless, enabling it is not, so
# only the enable step stays manual.
#
# Removes the destination first so this is always an exact mirror of
# contrib/dev.omavm.bar/, never an old install's leftover files sitting
# alongside new ones: a plain `cp -r` only adds/overwrites, so a file
# renamed or removed from the plugin since a previous install would
# otherwise linger in $(QS_PLUGIN_DIR) forever and could still be picked
# up by the shell.
install-quickshell-plugin:
rm -rf $(QS_PLUGIN_DIR)
mkdir -p $(QS_PLUGIN_DIR)
cp -r contrib/dev.omavm.bar/. $(QS_PLUGIN_DIR)/
@echo "Copied to $(QS_PLUGIN_DIR). Review the QML, then:"
Expand Down
Loading
Loading