From 9a3b5f9041fb8dc8bd6df2f2a696e9dbd5535127 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:34:01 +0000 Subject: [PATCH 1/5] Initial plan From a22a203e0f834829f457fe7ec181b990a598e943 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:35:22 +0000 Subject: [PATCH 2/5] Add NixOS build workflow Co-authored-by: squassina <8495707+squassina@users.noreply.github.com> --- .github/workflows/build-nixos.yml | 77 +++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/build-nixos.yml diff --git a/.github/workflows/build-nixos.yml b/.github/workflows/build-nixos.yml new file mode 100644 index 00000000..4c4d92e6 --- /dev/null +++ b/.github/workflows/build-nixos.yml @@ -0,0 +1,77 @@ +name: Build (NixOS) + +on: + push: + branches: [main, master] + paths: + - '**.c' + - '**.h' + - '**.cpp' + - '**.scm' + - 'meson.build' + - 'meson_options.txt' + - 'flake.nix' + - 'nix/**' + - 'protocols/**' + - '.github/workflows/build-nixos.yml' + pull_request: + branches: [main, master] + paths: + - '**.c' + - '**.h' + - '**.cpp' + - '**.scm' + - 'meson.build' + - 'meson_options.txt' + - 'flake.nix' + - 'nix/**' + - 'protocols/**' + - '.github/workflows/build-nixos.yml' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Build project with Nix + run: | + nix build --print-build-logs + + - name: Check build outputs + run: | + echo "✅ Build completed successfully!" + echo "Built executables:" + ls -lh result/bin/ + + - name: Verify executables + run: | + # Check that mango executable exists and is executable + if [ -x "result/bin/mango" ]; then + echo "✅ mango executable found and is executable" + result/bin/mango --version || echo "Note: --version may not be supported" + else + echo "❌ mango executable not found or not executable" + exit 1 + fi + + # Check that mmsg executable exists and is executable + if [ -x "result/bin/mmsg" ]; then + echo "✅ mmsg executable found and is executable" + result/bin/mmsg --help || echo "Note: --help may not be supported" + else + echo "❌ mmsg executable not found or not executable" + exit 1 + fi From 2c731428900b38462c676acf06d342bc79cfb9ca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:36:02 +0000 Subject: [PATCH 3/5] Document NixOS build workflow in README Co-authored-by: squassina <8495707+squassina@users.noreply.github.com> --- .github/workflows/README.md | 53 +++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index f5ff96a5..07ca2bc6 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -6,7 +6,8 @@ This directory contains the GitHub Actions workflows for the MangoWC project. ### build.yml -**Purpose**: Builds the project to ensure code changes compile successfully. +**Purpose**: Builds the project on Arch Linux to ensure code changes compile +successfully. **Triggers**: @@ -46,6 +47,47 @@ This directory contains the GitHub Actions workflows for the MangoWC project. - All system packages from pacman (wayland, libinput, wlroots, mesa, etc.) - scenefx from AUR +### build-nixos.yml + +**Purpose**: Builds the project on NixOS using Nix flakes to ensure code +changes work correctly in the NixOS ecosystem. + +**Triggers**: + +- Push to `main` or `master` branch (only when code files change) +- Pull requests to `main` or `master` branch (only when code files change) +- Manual dispatch (workflow_dispatch) + +**Path filters** (only runs when these change): + +- Source files: `**.c`, `**.h`, `**.cpp`, `**.scm` +- Build files: `meson.build`, `meson_options.txt`, `flake.nix` +- Nix files: `nix/**` +- Protocol definitions: `protocols/**` +- Workflow file itself: `.github/workflows/build-nixos.yml` + +**What it does**: + +1. Runs on Ubuntu with Nix installed +2. Installs Nix with flakes and nix-command experimental features +3. Builds the project using `nix build` with the repository's flake.nix +4. Verifies that executables (mango and mmsg) are created and executable +5. Tests basic executable functionality + +**Build Strategy**: + +- Uses Nix flakes for reproducible builds +- All dependencies managed through Nix +- Leverages the repository's flake.nix configuration +- Dependencies from nixpkgs-unstable + +**Dependencies**: + +- Nix package manager with flakes support +- All dependencies defined in flake.nix and nix/default.nix +- scenefx from upstream flake +- wlroots 0.19 from nixpkgs + ### docs.yml **Purpose**: Validates markdown documentation for style and formatting consistency. @@ -100,11 +142,11 @@ This directory contains the GitHub Actions workflows for the MangoWC project. ## Development Notes -The build workflow ensures that: +The build workflows ensure that: -- Only runs when actual code or build configuration changes +- Only run when actual code or build configuration changes - All dependencies are properly installed -- The project compiles without errors +- The project compiles without errors on both Arch Linux and NixOS - Both main executables (`mango` and `mmsg`) are built successfully The docs workflow ensures that: @@ -113,8 +155,9 @@ The docs workflow ensures that: - Documentation follows consistent formatting - Markdown files are well-formed and free of common issues -If the build workflow fails, check: +If a build workflow fails, check: 1. Dependencies are up to date in the workflow file 2. wlroots and scenefx versions match requirements in meson.build 3. Build configuration in meson.build hasn't changed +4. For NixOS builds: flake.nix and nix/default.nix are correctly configured From 8de9685457e6fe1092a0f2c4ed6b6fc3b76a165d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:42:50 +0000 Subject: [PATCH 4/5] Rename build.yml to build-arch.yml and add different checks for each platform Co-authored-by: squassina <8495707+squassina@users.noreply.github.com> --- .github/workflows/README.md | 43 +++++++++++++------ .../workflows/{build.yml => build-arch.yml} | 26 ++++++++--- .github/workflows/build-nixos.yml | 11 +++++ 3 files changed, 60 insertions(+), 20 deletions(-) rename .github/workflows/{build.yml => build-arch.yml} (75%) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 07ca2bc6..b32c6b61 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -4,10 +4,10 @@ This directory contains the GitHub Actions workflows for the MangoWC project. ## Workflows -### build.yml +### build-arch.yml **Purpose**: Builds the project on Arch Linux to ensure code changes compile -successfully. +successfully and code is properly formatted. **Triggers**: @@ -20,17 +20,18 @@ successfully. - Source files: `**.c`, `**.h`, `**.cpp`, `**.scm` - Build files: `meson.build`, `meson_options.txt`, `flake.nix` - Protocol definitions: `protocols/**` -- Workflow file itself: `.github/workflows/build.yml` +- Workflow file itself: `.github/workflows/build-arch.yml` **What it does**: 1. Runs in Arch Linux container (archlinux:latest) -2. Updates system and installs all dependencies via pacman -3. Installs wlroots from official Arch repositories -4. Installs scenefx from AUR (Arch User Repository) -5. Configures the project with meson -6. Builds the project with ninja -7. Verifies the executables were created +2. Checks C/C++ code formatting with clang-format +3. Updates system and installs all dependencies via pacman +4. Installs wlroots from official Arch repositories +5. Installs scenefx from AUR (Arch User Repository) +6. Configures the project with meson +7. Builds the project with ninja +8. Verifies the executables were created **Build Strategy**: @@ -39,9 +40,15 @@ successfully. - wlroots installed from official Arch repositories - scenefx installed from AUR +**Code Quality Checks**: + +- Validates C/C++ code formatting with clang-format (LLVM style with tabs) +- Fails if code doesn't match the formatting defined in `.clang-format` + **Dependencies**: - Arch Linux container (archlinux:latest) +- clang-format for code formatting checks - Meson build system - Ninja build tool - All system packages from pacman (wayland, libinput, wlroots, mesa, etc.) @@ -69,10 +76,11 @@ changes work correctly in the NixOS ecosystem. **What it does**: 1. Runs on Ubuntu with Nix installed -2. Installs Nix with flakes and nix-command experimental features -3. Builds the project using `nix build` with the repository's flake.nix -4. Verifies that executables (mango and mmsg) are created and executable -5. Tests basic executable functionality +2. Validates the flake with `nix flake check` +3. Checks Nix code formatting with alejandra (the formatter defined in flake.nix) +4. Builds the project using `nix build` with the repository's flake.nix +5. Verifies that executables (mango and mmsg) are created and executable +6. Tests basic executable functionality **Build Strategy**: @@ -81,6 +89,12 @@ changes work correctly in the NixOS ecosystem. - Leverages the repository's flake.nix configuration - Dependencies from nixpkgs-unstable +**Code Quality Checks**: + +- Validates flake structure and outputs with `nix flake check` +- Checks Nix code formatting with alejandra formatter +- Ensures flake.nix and nix/*.nix files are properly formatted + **Dependencies**: - Nix package manager with flakes support @@ -148,6 +162,7 @@ The build workflows ensure that: - All dependencies are properly installed - The project compiles without errors on both Arch Linux and NixOS - Both main executables (`mango` and `mmsg`) are built successfully +- Code formatting standards are enforced (clang-format for C/C++, alejandra for Nix) The docs workflow ensures that: @@ -161,3 +176,5 @@ If a build workflow fails, check: 2. wlroots and scenefx versions match requirements in meson.build 3. Build configuration in meson.build hasn't changed 4. For NixOS builds: flake.nix and nix/default.nix are correctly configured +5. For Arch builds: Code is properly formatted (run `./format.sh` to fix) +6. For NixOS builds: Nix files are properly formatted (run `nix fmt` to fix) diff --git a/.github/workflows/build.yml b/.github/workflows/build-arch.yml similarity index 75% rename from .github/workflows/build.yml rename to .github/workflows/build-arch.yml index 664fc5f6..e2a2936c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-arch.yml @@ -1,4 +1,4 @@ -name: Build +name: Build (Arch Linux) on: push: @@ -12,7 +12,7 @@ on: - 'meson_options.txt' - 'flake.nix' - 'protocols/**' - - '.github/workflows/build.yml' + - '.github/workflows/build-arch.yml' pull_request: branches: [main, master] paths: @@ -24,7 +24,7 @@ on: - 'meson_options.txt' - 'flake.nix' - 'protocols/**' - - '.github/workflows/build.yml' + - '.github/workflows/build-arch.yml' workflow_dispatch: jobs: @@ -39,12 +39,24 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Check C/C++ code formatting + run: | + # Install clang-format + pacman -Syu --noconfirm + pacman -S --noconfirm clang + + # Check if code is properly formatted + echo "Checking code formatting with clang-format..." + clang-format --dry-run --Werror src/*/*.h src/*/*.c src/mango.c mmsg/mmsg.c mmsg/arg.h mmsg/dynarr.h || { + echo "❌ Code formatting check failed!" + echo "Run './format.sh' to fix formatting issues." + exit 1 + } + echo "✅ Code formatting check passed!" + - name: Update system and install dependencies run: | - # Update package database - pacman -Syu --noconfirm - - # Install build tools and all dependencies + # Install build tools and all dependencies (system already updated in format check) pacman -S --noconfirm \ base-devel \ git \ diff --git a/.github/workflows/build-nixos.yml b/.github/workflows/build-nixos.yml index 4c4d92e6..53ee3c1d 100644 --- a/.github/workflows/build-nixos.yml +++ b/.github/workflows/build-nixos.yml @@ -46,6 +46,17 @@ jobs: extra_nix_config: | experimental-features = nix-command flakes + - name: Check Nix flake + run: | + echo "Running nix flake check..." + nix flake check --print-build-logs + + - name: Check Nix formatting with alejandra + run: | + echo "Checking Nix code formatting..." + nix fmt -- --check . + echo "✅ Nix formatting check passed!" + - name: Build project with Nix run: | nix build --print-build-logs From b1438b7e71c367aa8edab4c3e7c6f543d44129b4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:55:34 +0000 Subject: [PATCH 5/5] Remove code formatting checks from both workflows Co-authored-by: squassina <8495707+squassina@users.noreply.github.com> --- .github/workflows/README.md | 39 +++++++++---------------------- .github/workflows/build-arch.yml | 20 ++++------------ .github/workflows/build-nixos.yml | 11 --------- 3 files changed, 15 insertions(+), 55 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index b32c6b61..93b20afc 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -7,7 +7,7 @@ This directory contains the GitHub Actions workflows for the MangoWC project. ### build-arch.yml **Purpose**: Builds the project on Arch Linux to ensure code changes compile -successfully and code is properly formatted. +successfully. **Triggers**: @@ -25,13 +25,12 @@ successfully and code is properly formatted. **What it does**: 1. Runs in Arch Linux container (archlinux:latest) -2. Checks C/C++ code formatting with clang-format -3. Updates system and installs all dependencies via pacman -4. Installs wlroots from official Arch repositories -5. Installs scenefx from AUR (Arch User Repository) -6. Configures the project with meson -7. Builds the project with ninja -8. Verifies the executables were created +2. Updates system and installs all dependencies via pacman +3. Installs wlroots from official Arch repositories +4. Installs scenefx from AUR (Arch User Repository) +5. Configures the project with meson +6. Builds the project with ninja +7. Verifies the executables were created **Build Strategy**: @@ -40,15 +39,9 @@ successfully and code is properly formatted. - wlroots installed from official Arch repositories - scenefx installed from AUR -**Code Quality Checks**: - -- Validates C/C++ code formatting with clang-format (LLVM style with tabs) -- Fails if code doesn't match the formatting defined in `.clang-format` - **Dependencies**: - Arch Linux container (archlinux:latest) -- clang-format for code formatting checks - Meson build system - Ninja build tool - All system packages from pacman (wayland, libinput, wlroots, mesa, etc.) @@ -76,11 +69,10 @@ changes work correctly in the NixOS ecosystem. **What it does**: 1. Runs on Ubuntu with Nix installed -2. Validates the flake with `nix flake check` -3. Checks Nix code formatting with alejandra (the formatter defined in flake.nix) -4. Builds the project using `nix build` with the repository's flake.nix -5. Verifies that executables (mango and mmsg) are created and executable -6. Tests basic executable functionality +2. Installs Nix with flakes and nix-command experimental features +3. Builds the project using `nix build` with the repository's flake.nix +4. Verifies that executables (mango and mmsg) are created and executable +5. Tests basic executable functionality **Build Strategy**: @@ -89,12 +81,6 @@ changes work correctly in the NixOS ecosystem. - Leverages the repository's flake.nix configuration - Dependencies from nixpkgs-unstable -**Code Quality Checks**: - -- Validates flake structure and outputs with `nix flake check` -- Checks Nix code formatting with alejandra formatter -- Ensures flake.nix and nix/*.nix files are properly formatted - **Dependencies**: - Nix package manager with flakes support @@ -162,7 +148,6 @@ The build workflows ensure that: - All dependencies are properly installed - The project compiles without errors on both Arch Linux and NixOS - Both main executables (`mango` and `mmsg`) are built successfully -- Code formatting standards are enforced (clang-format for C/C++, alejandra for Nix) The docs workflow ensures that: @@ -176,5 +161,3 @@ If a build workflow fails, check: 2. wlroots and scenefx versions match requirements in meson.build 3. Build configuration in meson.build hasn't changed 4. For NixOS builds: flake.nix and nix/default.nix are correctly configured -5. For Arch builds: Code is properly formatted (run `./format.sh` to fix) -6. For NixOS builds: Nix files are properly formatted (run `nix fmt` to fix) diff --git a/.github/workflows/build-arch.yml b/.github/workflows/build-arch.yml index e2a2936c..cc50cb40 100644 --- a/.github/workflows/build-arch.yml +++ b/.github/workflows/build-arch.yml @@ -39,24 +39,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Check C/C++ code formatting - run: | - # Install clang-format - pacman -Syu --noconfirm - pacman -S --noconfirm clang - - # Check if code is properly formatted - echo "Checking code formatting with clang-format..." - clang-format --dry-run --Werror src/*/*.h src/*/*.c src/mango.c mmsg/mmsg.c mmsg/arg.h mmsg/dynarr.h || { - echo "❌ Code formatting check failed!" - echo "Run './format.sh' to fix formatting issues." - exit 1 - } - echo "✅ Code formatting check passed!" - - name: Update system and install dependencies run: | - # Install build tools and all dependencies (system already updated in format check) + # Update package database + pacman -Syu --noconfirm + + # Install build tools and all dependencies pacman -S --noconfirm \ base-devel \ git \ diff --git a/.github/workflows/build-nixos.yml b/.github/workflows/build-nixos.yml index 53ee3c1d..4c4d92e6 100644 --- a/.github/workflows/build-nixos.yml +++ b/.github/workflows/build-nixos.yml @@ -46,17 +46,6 @@ jobs: extra_nix_config: | experimental-features = nix-command flakes - - name: Check Nix flake - run: | - echo "Running nix flake check..." - nix flake check --print-build-logs - - - name: Check Nix formatting with alejandra - run: | - echo "Checking Nix code formatting..." - nix fmt -- --check . - echo "✅ Nix formatting check passed!" - - name: Build project with Nix run: | nix build --print-build-logs