Merge pull request #9 from squassina/copilot/add-pipeline-for-nixos

Add NixOS build pipeline and rename Arch workflow
This commit is contained in:
Ricardo Squassina Lee 2026-02-18 12:01:08 -03:00 committed by GitHub
commit 18dc0838d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 130 additions and 10 deletions

View file

@ -4,9 +4,10 @@ This directory contains the GitHub Actions workflows for the MangoWC project.
## Workflows ## Workflows
### build.yml ### build-arch.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**: **Triggers**:
@ -19,7 +20,7 @@ This directory contains the GitHub Actions workflows for the MangoWC project.
- Source files: `**.c`, `**.h`, `**.cpp`, `**.scm` - Source files: `**.c`, `**.h`, `**.cpp`, `**.scm`
- Build files: `meson.build`, `meson_options.txt`, `flake.nix` - Build files: `meson.build`, `meson_options.txt`, `flake.nix`
- Protocol definitions: `protocols/**` - Protocol definitions: `protocols/**`
- Workflow file itself: `.github/workflows/build.yml` - Workflow file itself: `.github/workflows/build-arch.yml`
**What it does**: **What it does**:
@ -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.) - All system packages from pacman (wayland, libinput, wlroots, mesa, etc.)
- scenefx from AUR - 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 ### docs.yml
**Purpose**: Validates markdown documentation for style and formatting consistency. **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 ## 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 - 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 - Both main executables (`mango` and `mmsg`) are built successfully
The docs workflow ensures that: The docs workflow ensures that:
@ -113,8 +155,9 @@ The docs workflow ensures that:
- Documentation follows consistent formatting - Documentation follows consistent formatting
- Markdown files are well-formed and free of common issues - 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 1. Dependencies are up to date in the workflow file
2. wlroots and scenefx versions match requirements in meson.build 2. wlroots and scenefx versions match requirements in meson.build
3. Build configuration in meson.build hasn't changed 3. Build configuration in meson.build hasn't changed
4. For NixOS builds: flake.nix and nix/default.nix are correctly configured

View file

@ -1,4 +1,4 @@
name: Build name: Build (Arch Linux)
on: on:
push: push:
@ -12,7 +12,7 @@ on:
- 'meson_options.txt' - 'meson_options.txt'
- 'flake.nix' - 'flake.nix'
- 'protocols/**' - 'protocols/**'
- '.github/workflows/build.yml' - '.github/workflows/build-arch.yml'
pull_request: pull_request:
branches: [main, master] branches: [main, master]
paths: paths:
@ -24,7 +24,7 @@ on:
- 'meson_options.txt' - 'meson_options.txt'
- 'flake.nix' - 'flake.nix'
- 'protocols/**' - 'protocols/**'
- '.github/workflows/build.yml' - '.github/workflows/build-arch.yml'
workflow_dispatch: workflow_dispatch:
jobs: jobs:

77
.github/workflows/build-nixos.yml vendored Normal file
View file

@ -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