4
0
Эх сурвалжийг харах

Added Justfile for developer productivity and dev-setup guide on required software/packages for development activities

David Walshe 1 сар өмнө
parent
commit
698eb77539
2 өөрчлөгдсөн 215 нэмэгдсэн , 0 устгасан
  1. 102 0
      docs/development/dev-setup.md
  2. 113 0
      justfile

+ 102 - 0
docs/development/dev-setup.md

@@ -0,0 +1,102 @@
+# Developer Setup
+
+---
+
+This guide is targetted at developers willing to get involved in the development of RackPeek.
+
+Please review all commands in this guide carefully before execution and ensure you understand the implications of each step.
+
+This guide is by no means exhaustive, so please feel free to contribute back to it if you have any additional information or tips.
+
+## Brew Installation
+
+This project leverages the [brew](https://brew.sh) package manager for installation of dependencies on MacOS/Linux
+
+Please follow the installation instructions for Brew as found [here](https://brew.sh/index#installation)
+
+## Just Installation
+
+This project makes use of the [Just](https://github.com/casey/just) tool for streamlining development and developer productivity.
+
+If using Homebrew, installation is as simple as:
+
+```shell
+brew install just
+```
+
+Please follow your preferred installation method for Just as found [here](https://github.com/casey/just?tab=readme-ov-file#installation) if not using [brew](https://brew.sh).
+
+## VHS Installation
+
+This project makes use of the [VHS](https://github.com/charmbracelet/vhs) tool for recording and creating GIFs of the CLI for documentation purposes.
+
+If using Homebrew, installation is as simple as:
+
+```shell
+brew install vhs
+```
+
+Please follow your preferred installation method for VHS as found [here](https://github.com/charmbracelet/vhs?tab=readme-ov-file#installation) if not using [brew](https://brew.sh).
+
+## DotNet Installation
+
+For those looking for a quick start for getting setup with `dotnet` for development on RackPeek, please follow the instructions below.
+
+### Ubuntu Linux
+
+Setup the development environment on Ubuntu Linux.
+
+#### Install Prerequisites
+
+```shell
+sudo apt update
+sudo apt install -y wget apt-transport-https software-properties-common
+```
+
+#### Download and Register Microsoft Package Repository
+
+Find linux distribution version:
+
+```shell
+export RACKPEEK_KERNEL_VERSION=$(dpkg -l | grep linux-image | grep ii | head -1 | awk '{print $3}' | sed 's/.*~\([0-9]*\.[0-9]*\)\..*/\1/')
+```
+
+Ensure the correct kernel version was found (example: `22.04`, `24.04`, etc.):
+
+```shell
+echo "KERNEL_VERSION: ${RACKPEEK_KERNEL_VERSION}"
+```
+
+Download and register the Microsoft package repository:
+
+```shell
+wget https://packages.microsoft.com/config/ubuntu/${RACKPEEK_KERNEL_VERSION}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
+sudo dpkg -i packages-microsoft-prod.deb
+rm packages-microsoft-prod.deb
+```
+
+Update package lists:
+
+```shell
+sudo apt update
+```
+
+#### Install .NET 10 SDK
+
+```shell
+sudo apt install -y dotnet-sdk-10.0
+```
+
+#### Verify Installation
+
+```shell
+dotnet --version
+```
+
+### MacOS
+
+🏗️ Help wanted for guide on MacOS development environment setup.
+
+### Windows
+
+🏗️ Help wanted for guide on Windows development environment setup.

+ 113 - 0
justfile

@@ -0,0 +1,113 @@
+# RackPeek Development Commands
+# Run `just` or `just --list` to see available recipes.
+
+# Environment Variables
+# ---------------------
+
+# Add .dotnet/tools to PATH for Playwright CLI
+export PATH := env_var('HOME') + "/.dotnet/tools:" + env_var_or_default('PATH', '')
+
+
+# Variables
+# ---------
+_dotnet := "dotnet"
+_dockerfile := "RackPeek.Web/Dockerfile"
+_image := "rackpeek:ci"
+_setup_guide := "docs/development/dev-setup.md"
+
+# ─── Helpers/Private ────────────────────────────────────────────────────────
+
+[doc("Check if dotnet is installed, show setup guide redirect if not found.")]
+[private]
+_check-dotnet:
+    @command -v {{ _dotnet }} >/dev/null 2>&1 || (echo "dotnet not found. See {{ _setup_guide }} for setup instructions." && exit 1)
+
+# ─── Default ────────────────────────────────────────────────────────────────
+
+[default]
+[doc("List all recipes with documentation")]
+[private]
+default:
+    @just --list --justfile {{ justfile() }}
+
+# ─── Build ──────────────────────────────────────────────────────────────────
+
+[doc("Build the full solution (Debug)")]
+[group("build")]
+build: _check-dotnet
+    {{ _dotnet }} build RackPeek.sln
+
+[doc("Build the full solution in Release mode")]
+[group("build")]
+build-release: _check-dotnet
+    {{ _dotnet }} build RackPeek.sln -c Release
+
+[doc("Publish CLI as self-contained single-file binary")]
+[group("build")]
+build-cli runtime="linux-x64": _check-dotnet
+    {{ _dotnet }} publish RackPeek/RackPeek.csproj -c Release -r {{ runtime }} \
+        --self-contained true \
+        -p:PublishSingleFile=true
+
+[doc("Build Web Docker image (required before E2E tests)")]
+[group("build")]
+build-web:
+    docker build -t {{ _image }} -f {{ _dockerfile }} .
+
+# ─── Test ───────────────────────────────────────────────────────────────────
+
+[doc("Run CLI tests (fast; no Docker required)")]
+[group("test")]
+test-cli: _check-dotnet
+    {{ _dotnet }} test Tests/Tests.csproj
+
+[doc("Install Playwright + browsers for E2E (first-time only)")]
+[group("test")]
+e2e-setup: _check-dotnet
+    cd Tests.E2e && {{ _dotnet }} tool install --global Microsoft.Playwright.CLI
+    cd Tests.E2e && {{ _dotnet }} build
+    cd Tests.E2e && playwright install
+
+[doc("Run E2E tests (depends on build-web; run e2e-setup once)")]
+[group("test")]
+test-e2e: _check-dotnet build-web
+    cd Tests.E2e && {{ _dotnet }} test
+
+[doc("Run CLI + E2E tests (rebuilds Web image)")]
+[group("test")]
+test-all: _check-dotnet build-web e2e-setup test-cli test-e2e
+
+[doc("Run full test suite (alias for test-all; matches CI / pre-PR checklist)")]
+[group("test")]
+ci: test-all
+
+# ─── Demo ───────────────────────────────────────────────────────────────────
+
+[doc("Generate CLI demo with VHS (needs: vhs, imagemagick, chrome)")]
+[group("demo")]
+build-cli-demo:
+    cd vhs && vhs ./rpk.tape
+
+[doc("Capture Web UI demo as GIF (needs: Chrome, ImageMagick)")]
+[group("demo")]
+build-web-demo:
+    cd vhs && chmod +x webui_capture.sh && ./webui_capture.sh
+
+# ─── Release ────────────────────────────────────────────────────────────────
+
+[doc("Build and push multi-arch Docker image to registry")]
+[group("release")]
+docker-push version:
+    docker buildx build \
+        --platform linux/amd64,linux/arm64 \
+        -f {{ _dockerfile }} \
+        -t aptacode/rackpeek:{{ version }} \
+        -t aptacode/rackpeek:latest \
+        --push .
+
+# ─── Utility ────────────────────────────────────────────────────────────────
+
+[doc("Clean build artifacts (bin, obj)")]
+[group("utility")]
+clean: _check-dotnet
+    {{ _dotnet }} clean RackPeek.sln