From 50afc46ebbd9246a160c3e666ce99802e6c715ef Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 17:45:26 +0200 Subject: [PATCH 01/13] test-docker: Trying local docker image for CI. Signed-off-by: Dylan Hollemaert --- .github/workflows/ci.yml | 97 +++++++++++++++++++++++++++ DockerRunner/.gitignore | 2 + DockerRunner/Dockerfile | 40 +++++++++++ DockerRunner/README.md | 78 +++++++++++++++++++++ DockerRunner/docker-compose.yml | 12 ++++ DockerRunner/entrypoint.sh | 53 +++++++++++++++ DockerRunner/start-runner.ps1.example | 29 ++++++++ DockerRunner/stop-runner.ps1 | 10 +++ 8 files changed, 321 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 DockerRunner/.gitignore create mode 100644 DockerRunner/Dockerfile create mode 100644 DockerRunner/README.md create mode 100644 DockerRunner/docker-compose.yml create mode 100644 DockerRunner/entrypoint.sh create mode 100644 DockerRunner/start-runner.ps1.example create mode 100644 DockerRunner/stop-runner.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8b52311 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,97 @@ +name: CMake on multiple platforms + +on: + push: + branches: [ "test-docker" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + # Was: runs-on: ${{ matrix.os }} (ubuntu-latest / windows-latest, GitHub-hosted) + # Now: dispatched to your self-hosted Docker runner instead. + # + # IMPORTANT: a Linux container runner can only truthfully run the + # ubuntu-latest legs. It cannot become Windows/MSVC. The windows-latest + # + cl combination is excluded below and the matrix instead cross-builds + # that leg with mingw on the same runner (see cpp_compiler override). + # If you need a REAL MSVC leg reporting into this same workflow, that + # requires a second self-hosted runner registered from an actual + # Windows machine, labeled e.g. "self-hosted,windows,x64" (see notes + # at the bottom of this file). + runs-on: [self-hosted, docker-local, linux-x64] + + strategy: + fail-fast: false + + matrix: + os: [ubuntu-latest, windows-latest] + build_type: [Release, Debug] + c_compiler: [gcc, clang, cl] + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: x86_64-w64-mingw32-g++ # mingw cross-compile approximation + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + exclude: + - os: windows-latest + c_compiler: gcc + - os: windows-latest + c_compiler: clang + - os: ubuntu-latest + c_compiler: cl + + steps: + - uses: actions/checkout@v4 + + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Resolve actual compiler command + id: cc + shell: bash + run: | + # windows-latest/cl leg runs as a mingw cross-compile on this runner + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + echo "c=x86_64-w64-mingw32-gcc" >> "$GITHUB_OUTPUT" + echo "cxx=x86_64-w64-mingw32-g++" >> "$GITHUB_OUTPUT" + else + echo "c=${{ matrix.c_compiler }}" >> "$GITHUB_OUTPUT" + echo "cxx=${{ matrix.cpp_compiler }}" >> "$GITHUB_OUTPUT" + fi + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ steps.cc.outputs.cxx }} + -DCMAKE_C_COMPILER=${{ steps.cc.outputs.c }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DNEXUS_BUILD_TEST=ON + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + - name: Test + # mingw cross-build can't run its own .exe on this Linux runner, so + # skip the test step for that leg — build success is all we get for it + if: matrix.c_compiler != 'cl' + working-directory: ${{ steps.strings.outputs.build-output-dir }}/Tests + run: ctest --build-config ${{ matrix.build_type }} + +# --- Notes ----------------------------------------------------------------- +# To get a genuine MSVC/windows-latest leg showing in this same Actions run: +# 1. Register a second self-hosted runner FROM an actual Windows machine +# (physical, VM, or cloud instance) — not Docker; MSVC requires the +# real OS. Give it labels like: self-hosted, windows, x64 +# 2. Split this job into two jobs (linux-build / windows-build) each with +# its own `runs-on` matching the runner that can actually do the work, +# instead of one job with a mixed matrix. diff --git a/DockerRunner/.gitignore b/DockerRunner/.gitignore new file mode 100644 index 0000000..7602b71 --- /dev/null +++ b/DockerRunner/.gitignore @@ -0,0 +1,2 @@ +# Contains your PAT filled in directly — never commit this +start-runner.ps1 diff --git a/DockerRunner/Dockerfile b/DockerRunner/Dockerfile new file mode 100644 index 0000000..5330af4 --- /dev/null +++ b/DockerRunner/Dockerfile @@ -0,0 +1,40 @@ +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive +ARG RUNNER_VERSION=2.321.0 + +# --- build toolchains (same as before: gcc, clang, mingw for windows-approx) --- +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + ninja-build \ + git \ + gcc \ + g++ \ + clang \ + lldb \ + lld \ + mingw-w64 \ + ca-certificates \ + curl \ + jq \ + sudo \ + libicu-dev \ + && rm -rf /var/lib/apt/lists/* + +# --- GitHub Actions self-hosted runner agent --- +RUN useradd -m runner && \ + mkdir -p /home/runner/actions-runner && \ + cd /home/runner/actions-runner && \ + curl -o actions-runner.tar.gz -L \ + "https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz" && \ + tar xzf actions-runner.tar.gz && \ + rm actions-runner.tar.gz && \ + ./bin/installdependencies.sh && \ + chown -R runner:runner /home/runner/actions-runner + +USER runner +WORKDIR /home/runner/actions-runner + +COPY --chown=runner:runner entrypoint.sh /home/runner/entrypoint.sh +ENTRYPOINT ["/home/runner/entrypoint.sh"] diff --git a/DockerRunner/README.md b/DockerRunner/README.md new file mode 100644 index 0000000..25b1b85 --- /dev/null +++ b/DockerRunner/README.md @@ -0,0 +1,78 @@ +# Self-hosted GitHub Actions runner (Docker, Windows) + +Makes your `git push` / PRs trigger a real job that runs on your machine, +inside Docker, and shows up in the repo's **Actions** tab exactly like a +GitHub-hosted run would. + +## Limitation, stated plainly + +This runner is a Linux container (Docker Desktop on Windows runs Linux +containers via WSL2). It can genuinely execute the `ubuntu-latest` + +gcc/clang matrix legs. It **cannot** become real Windows/MSVC — `cl` isn't +installable or runnable inside a Linux container, regardless of the host +OS. The provided `ci.yml` handles the `windows-latest`/`cl` leg as a +mingw-w64 cross-compile (build-only, no test execution) on this same +container, and labels it as such in the job output. + +## One-time setup + +1. **Docker Desktop** — confirm it's running (you said it's already + installed, good). + +2. **Fine-grained PAT**: GitHub -> avatar -> Settings -> Developer settings -> + Personal access tokens -> Fine-grained tokens -> Generate new token. + Scope to this repo only, permission: **Administration: Read and write**. + +3. Copy `start-runner.ps1.example` to `start-runner.ps1` and fill in your + three values (`GH_PAT`, `GH_OWNER`, `GH_REPO`): + ```powershell + Copy-Item start-runner.ps1.example start-runner.ps1 + notepad start-runner.ps1 + ``` + `start-runner.ps1` is gitignored -- it holds your real token, never commit it. + +4. Replace your repo's `.github\workflows\ci.yml` with the one provided + earlier (or merge the `runs-on` / matrix changes into your existing one). + +## Running the runner + +From PowerShell, in this folder: + +```powershell +.\start-runner.ps1 +``` + +First run may prompt an execution-policy warning. If PowerShell refuses to +run the script, either right-click the file -> "Run with PowerShell", or run +once per session: +```powershell +Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass +``` + +This builds the image, registers the container as a runner against your +repo, and leaves it running in the background. Check GitHub -> repo -> +**Settings -> Actions -> Runners** -- it should show as **Idle**. + +Push a commit or open a PR -- the run appears in the **Actions** tab as +normal, executing on your container. + +Stop it (also deregisters automatically): +```powershell +.\stop-runner.ps1 +``` + +View live logs any time: +```powershell +docker compose logs -f +``` + +## Notes + +- Runner labels: `docker-local, linux-x64, self-hosted` -- `ci.yml`'s + `runs-on: [self-hosted, docker-local, linux-x64]` targets exactly this + container. +- `restart: unless-stopped` in `docker-compose.yml` means Docker Desktop + restarting (e.g. after your PC reboots) brings the runner back up and it + re-registers automatically. +- The runner checks out your repo itself per-job over the network -- no + local repo path or bind mount needed. diff --git a/DockerRunner/docker-compose.yml b/DockerRunner/docker-compose.yml new file mode 100644 index 0000000..3ac2b76 --- /dev/null +++ b/DockerRunner/docker-compose.yml @@ -0,0 +1,12 @@ +services: + gh-runner: + build: . + environment: + - GH_PAT=${GH_PAT} + - GH_OWNER=${GH_OWNER} + - GH_REPO=${GH_REPO} + - RUNNER_NAME=docker-local-runner + - RUNNER_LABELS=docker-local,linux-x64,self-hosted + restart: unless-stopped + # runner needs to check out your repo itself (GitHub tells it what to + # check out), so no source bind-mount needed here like the old setup diff --git a/DockerRunner/entrypoint.sh b/DockerRunner/entrypoint.sh new file mode 100644 index 0000000..e15e818 --- /dev/null +++ b/DockerRunner/entrypoint.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Required env vars: +# GH_PAT - fine-grained PAT scoped to this repo, "Administration: read & write" +# GH_OWNER - e.g. "dylan" +# GH_REPO - e.g. "nexus" +# +# Optional: +# RUNNER_NAME - defaults to hostname +# RUNNER_LABELS - defaults to "docker-local,linux-x64" + +: "${GH_PAT:?Set GH_PAT to a fine-grained PAT with Administration: read/write on the repo}" +: "${GH_OWNER:?Set GH_OWNER (e.g. your github username or org)}" +: "${GH_REPO:?Set GH_REPO (repo name, no owner prefix)}" + +RUNNER_NAME="${RUNNER_NAME:-$(hostname)}" +RUNNER_LABELS="${RUNNER_LABELS:-docker-local,linux-x64}" + +API="https://api.github.com/repos/${GH_OWNER}/${GH_REPO}" + +echo "==> Requesting runner registration token from GitHub..." +REG_TOKEN=$(curl -sX POST \ + -H "Authorization: Bearer ${GH_PAT}" \ + -H "Accept: application/vnd.github+json" \ + "${API}/actions/runners/registration-token" | jq -r .token) + +if [[ -z "$REG_TOKEN" || "$REG_TOKEN" == "null" ]]; then + echo "Failed to get registration token. Check GH_PAT permissions and GH_OWNER/GH_REPO." >&2 + exit 1 +fi + +echo "==> Configuring runner '${RUNNER_NAME}' with labels [${RUNNER_LABELS}]..." +./config.sh \ + --url "https://github.com/${GH_OWNER}/${GH_REPO}" \ + --token "${REG_TOKEN}" \ + --name "${RUNNER_NAME}" \ + --labels "${RUNNER_LABELS}" \ + --unattended \ + --replace + +cleanup() { + echo "==> Deregistering runner..." + REMOVE_TOKEN=$(curl -sX POST \ + -H "Authorization: Bearer ${GH_PAT}" \ + -H "Accept: application/vnd.github+json" \ + "${API}/actions/runners/remove-token" | jq -r .token) + ./config.sh remove --token "${REMOVE_TOKEN}" || true +} +trap cleanup EXIT INT TERM + +echo "==> Starting runner..." +./run.sh diff --git a/DockerRunner/start-runner.ps1.example b/DockerRunner/start-runner.ps1.example new file mode 100644 index 0000000..fcbe8fc --- /dev/null +++ b/DockerRunner/start-runner.ps1.example @@ -0,0 +1,29 @@ +# start-runner.ps1 +# Sets up env vars and starts the self-hosted GitHub Actions runner in Docker. +# +# Usage: +# 1. Fill in the three values below (or set them once via $env: before running this script) +# 2. Right-click > Run with PowerShell, OR from a PowerShell prompt: .\start-runner.ps1 +# +# Requires: Docker Desktop running. + +# --- Fill these in --------------------------------------------------------- +$env:GH_PAT = "github_pat_xxxxxxxx" # your fine-grained PAT +$env:GH_OWNER = "your-username" # your GitHub username or org +$env:GH_REPO = "your-repo-name" # repo name only, no owner prefix +# ----------------------------------------------------------------------- + +if ($env:GH_PAT -eq "github_pat_xxxxxxxx") { + Write-Host "Edit start-runner.ps1 and fill in GH_PAT, GH_OWNER, GH_REPO first." -ForegroundColor Red + exit 1 +} + +Write-Host "==> Building and starting the runner container..." -ForegroundColor Cyan +docker compose up --build -d + +if ($LASTEXITCODE -eq 0) { + Write-Host "==> Runner starting. Check GitHub -> repo -> Settings -> Actions -> Runners for 'Idle' status." -ForegroundColor Green + Write-Host "==> View logs with: docker compose logs -f" -ForegroundColor Yellow +} else { + Write-Host "==> docker compose failed, see output above." -ForegroundColor Red +} diff --git a/DockerRunner/stop-runner.ps1 b/DockerRunner/stop-runner.ps1 new file mode 100644 index 0000000..2e04363 --- /dev/null +++ b/DockerRunner/stop-runner.ps1 @@ -0,0 +1,10 @@ +# stop-runner.ps1 +# Stops the runner container. The container's own trap (in entrypoint.sh) +# deregisters it from GitHub automatically as it shuts down. +# +# Usage: .\stop-runner.ps1 + +Write-Host "==> Stopping runner container..." -ForegroundColor Cyan +docker compose down + +Write-Host "==> Done. Check GitHub -> repo -> Settings -> Actions -> Runners to confirm it's gone." -ForegroundColor Green From 4b022782072581f505ef079a78d35420e41fcd21 Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 17:59:57 +0200 Subject: [PATCH 02/13] ci: update CMake, GCC and Clang * Next issue will probably be Ninja. Signed-off-by: Dylan Hollemaert --- DockerRunner/Dockerfile | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/DockerRunner/Dockerfile b/DockerRunner/Dockerfile index 5330af4..d7ff238 100644 --- a/DockerRunner/Dockerfile +++ b/DockerRunner/Dockerfile @@ -3,26 +3,49 @@ FROM ubuntu:24.04 ENV DEBIAN_FRONTEND=noninteractive ARG RUNNER_VERSION=2.321.0 -# --- build toolchains (same as before: gcc, clang, mingw for windows-approx) --- +ARG GCC_VERSION=16 +ARG LLVM_VERSION=21 + RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ - cmake \ ninja-build \ git \ - gcc \ - g++ \ - clang \ - lldb \ - lld \ mingw-w64 \ ca-certificates \ curl \ + gnupg \ + lsb-release \ + software-properties-common \ + wget \ jq \ sudo \ libicu-dev \ && rm -rf /var/lib/apt/lists/* -# --- GitHub Actions self-hosted runner agent --- +RUN wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc \ + | gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main" \ + > /etc/apt/sources.list.d/kitware.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends cmake && \ + rm -rf /var/lib/apt/lists/* + +RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + gcc-${GCC_VERSION} g++-${GCC_VERSION} && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 && \ + rm -rf /var/lib/apt/lists/* + +RUN wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \ + chmod +x /tmp/llvm.sh && \ + /tmp/llvm.sh ${LLVM_VERSION} all && \ + update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 && \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100 && \ + rm -f /tmp/llvm.sh && \ + rm -rf /var/lib/apt/lists/* + RUN useradd -m runner && \ mkdir -p /home/runner/actions-runner && \ cd /home/runner/actions-runner && \ From 756ad61758eb4496c9fe0f6d0d16764913f0e62b Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 18:02:17 +0200 Subject: [PATCH 03/13] ci: Use Ninja generator Signed-off-by: Dylan Hollemaert --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b52311..8ed7fa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,7 @@ jobs: -DCMAKE_C_COMPILER=${{ steps.cc.outputs.c }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DNEXUS_BUILD_TEST=ON + -G Ninja -S ${{ github.workspace }} - name: Build From 63b0b9abe223b50fd19b5b3ed33f0db47dfae4f2 Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 18:10:42 +0200 Subject: [PATCH 04/13] ci: add Wayland packages Signed-off-by: Dylan Hollemaert --- DockerRunner/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/DockerRunner/Dockerfile b/DockerRunner/Dockerfile index d7ff238..eeeaa90 100644 --- a/DockerRunner/Dockerfile +++ b/DockerRunner/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ jq \ sudo \ libicu-dev \ + libwayland-dev \ && rm -rf /var/lib/apt/lists/* RUN wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc \ From a3248d855d1bcf62d70375c0910d9c3bd9898cbc Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 18:32:21 +0200 Subject: [PATCH 05/13] ci: update ninja Signed-off-by: Dylan Hollemaert --- DockerRunner/Dockerfile | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/DockerRunner/Dockerfile b/DockerRunner/Dockerfile index eeeaa90..ddc6949 100644 --- a/DockerRunner/Dockerfile +++ b/DockerRunner/Dockerfile @@ -1,14 +1,15 @@ FROM ubuntu:24.04 ENV DEBIAN_FRONTEND=noninteractive -ARG RUNNER_VERSION=2.321.0 +ARG RUNNER_VERSION=2.337.0 ARG GCC_VERSION=16 -ARG LLVM_VERSION=21 +ARG LLVM_VERSION=22 +# APT Packages RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ - ninja-build \ + unzip \ git \ mingw-w64 \ ca-certificates \ @@ -21,8 +22,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ sudo \ libicu-dev \ libwayland-dev \ + pkg-config \ + libx11-dev \ + libxrandr-dev \ + libxinerama-dev \ + libxcursor-dev \ + libxi-dev \ && rm -rf /var/lib/apt/lists/* +# Ninja +RUN wget -q https://github.com/ninja-build/ninja/releases/download/v1.13.2/ninja-linux.zip \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && chmod +x /usr/local/bin/ninja \ + && rm ninja-linux.zip + +# CMake RUN wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc \ | gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg && \ echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main" \ @@ -31,6 +45,7 @@ RUN wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc \ apt-get install -y --no-install-recommends cmake && \ rm -rf /var/lib/apt/lists/* +# GCC version ${GCC_VERSION} RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ apt-get update && \ apt-get install -y --no-install-recommends \ @@ -39,6 +54,7 @@ RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 && \ rm -rf /var/lib/apt/lists/* +# LLVM version ${LLVM_VERSION} RUN wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \ chmod +x /tmp/llvm.sh && \ /tmp/llvm.sh ${LLVM_VERSION} all && \ @@ -47,6 +63,7 @@ RUN wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \ rm -f /tmp/llvm.sh && \ rm -rf /var/lib/apt/lists/* +# GitHub Actions runner download RUN useradd -m runner && \ mkdir -p /home/runner/actions-runner && \ cd /home/runner/actions-runner && \ From e6b5a679999c88f0b5025045f2e75de89a1a1c92 Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 18:40:57 +0200 Subject: [PATCH 06/13] ci: add xkbcommon and wayland protocols. Signed-off-by: Dylan Hollemaert --- DockerRunner/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DockerRunner/Dockerfile b/DockerRunner/Dockerfile index ddc6949..3feabb2 100644 --- a/DockerRunner/Dockerfile +++ b/DockerRunner/Dockerfile @@ -28,6 +28,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libxinerama-dev \ libxcursor-dev \ libxi-dev \ + libxkbcommon-dev \ + wayland-protocols \ && rm -rf /var/lib/apt/lists/* # Ninja From 1474c24fce4c55c0d8b48a0768ca325da4770826 Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 19:11:47 +0200 Subject: [PATCH 07/13] ci: revamp to support windows. Signed-off-by: Dylan Hollemaert --- .github/workflows/ci.yml | 188 ++++++++++++++++++++++++--------------- 1 file changed, 118 insertions(+), 70 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ed7fa6..a0b40f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,19 +8,6 @@ on: jobs: build: - # Was: runs-on: ${{ matrix.os }} (ubuntu-latest / windows-latest, GitHub-hosted) - # Now: dispatched to your self-hosted Docker runner instead. - # - # IMPORTANT: a Linux container runner can only truthfully run the - # ubuntu-latest legs. It cannot become Windows/MSVC. The windows-latest - # + cl combination is excluded below and the matrix instead cross-builds - # that leg with mingw on the same runner (see cpp_compiler override). - # If you need a REAL MSVC leg reporting into this same workflow, that - # requires a second self-hosted runner registered from an actual - # Windows machine, labeled e.g. "self-hosted,windows,x64" (see notes - # at the bottom of this file). - runs-on: [self-hosted, docker-local, linux-x64] - strategy: fail-fast: false @@ -28,71 +15,132 @@ jobs: os: [ubuntu-latest, windows-latest] build_type: [Release, Debug] c_compiler: [gcc, clang, cl] + include: - - os: windows-latest - c_compiler: cl - cpp_compiler: x86_64-w64-mingw32-g++ # mingw cross-compile approximation - os: ubuntu-latest - c_compiler: gcc + runner: [self-hosted, docker-local, linux-x64] + + - os: windows-latest + runner: [self-hosted, windows-local, x64] + + - c_compiler: gcc cpp_compiler: g++ - - os: ubuntu-latest - c_compiler: clang + + - c_compiler: clang cpp_compiler: clang++ + + - c_compiler: cl + cpp_compiler: cl + exclude: - - os: windows-latest - c_compiler: gcc - - os: windows-latest - c_compiler: clang - os: ubuntu-latest c_compiler: cl + runs-on: ${{ matrix.runner }} + steps: - - uses: actions/checkout@v4 - - - name: Set reusable strings - id: strings - shell: bash - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - - name: Resolve actual compiler command - id: cc - shell: bash - run: | - # windows-latest/cl leg runs as a mingw cross-compile on this runner - if [ "${{ matrix.c_compiler }}" = "cl" ]; then - echo "c=x86_64-w64-mingw32-gcc" >> "$GITHUB_OUTPUT" - echo "cxx=x86_64-w64-mingw32-g++" >> "$GITHUB_OUTPUT" - else + - name: Checkout + uses: actions/checkout@v4 + + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Setup MSVC + if: matrix.os == 'windows-latest' && matrix.c_compiler == 'cl' + shell: powershell + run: | + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + + if (-not (Test-Path $vswhere)) { + throw "vswhere.exe not found at $vswhere" + } + + $vsPath = & $vswhere ` + -latest ` + -products * ` + -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` + -property installationPath + + if (-not $vsPath) { + throw "Visual Studio installation with MSVC tools not found." + } + + Write-Host "Visual Studio: $vsPath" + + $vsDevCmd = Join-Path $vsPath "Common7\Tools\VsDevCmd.bat" + $envDump = Join-Path $env:RUNNER_TEMP "vs-env.txt" + + cmd /c "`"$vsDevCmd`" -arch=x64 -host_arch=x64 && set > `"$envDump`"" + + if ($LASTEXITCODE -ne 0) { + throw "VsDevCmd.bat failed." + } + + Get-Content $envDump | ForEach-Object { + if ($_ -match '^([^=]+)=(.*)$') { + $name = $matches[1] + $value = $matches[2] + + if ($name -ne "Path" -and $name -ne "PATHEXT") { + "$name=$value" >> $env:GITHUB_ENV + } + } + } + + $pathLine = Get-Content $envDump | + Where-Object { $_ -match '^Path=' } | + Select-Object -First 1 + + if ($pathLine) { + $pathValue = $pathLine.Substring(5) + $pathValue -split ';' | + Where-Object { $_ } | + ForEach-Object { + $_ >> $env:GITHUB_PATH + } + } + + - name: Resolve actual compiler command + id: cc + shell: bash + run: | echo "c=${{ matrix.c_compiler }}" >> "$GITHUB_OUTPUT" echo "cxx=${{ matrix.cpp_compiler }}" >> "$GITHUB_OUTPUT" - fi - - - name: Configure CMake - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=${{ steps.cc.outputs.cxx }} - -DCMAKE_C_COMPILER=${{ steps.cc.outputs.c }} - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -DNEXUS_BUILD_TEST=ON - -G Ninja - -S ${{ github.workspace }} - - - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - - - name: Test - # mingw cross-build can't run its own .exe on this Linux runner, so - # skip the test step for that leg — build success is all we get for it - if: matrix.c_compiler != 'cl' - working-directory: ${{ steps.strings.outputs.build-output-dir }}/Tests - run: ctest --build-config ${{ matrix.build_type }} - -# --- Notes ----------------------------------------------------------------- -# To get a genuine MSVC/windows-latest leg showing in this same Actions run: -# 1. Register a second self-hosted runner FROM an actual Windows machine -# (physical, VM, or cloud instance) — not Docker; MSVC requires the -# real OS. Give it labels like: self-hosted, windows, x64 -# 2. Split this job into two jobs (linux-build / windows-build) each with -# its own `runs-on` matching the runner that can actually do the work, -# instead of one job with a mixed matrix. + + - name: Check compilers + if: matrix.c_compiler != 'cl' + shell: bash + run: | + ${{ steps.cc.outputs.c }} --version + ${{ steps.cc.outputs.cxx }} --version + + - name: Check MSVC + if: matrix.c_compiler == 'cl' + shell: cmd + run: | + cl + + - name: Check CMake and Ninja + run: | + cmake --version + ninja --version + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ steps.cc.outputs.cxx }} + -DCMAKE_C_COMPILER=${{ steps.cc.outputs.c }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DNEXUS_BUILD_TEST=ON + -G Ninja + -S ${{ github.workspace }} + + - name: Build + run: cmake --build "${{ steps.strings.outputs.build-output-dir }}" --config ${{ matrix.build_type }} + + - name: Test + working-directory: ${{ steps.strings.outputs.build-output-dir }}/Tests + run: ctest --build-config ${{ matrix.build_type }} From 58e85fb4aaca62722bb6e0ed8442628baa80d868 Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 19:30:55 +0200 Subject: [PATCH 08/13] ci: windows fixes Signed-off-by: Dylan Hollemaert --- .github/workflows/ci.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0b40f8..8ab1c2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set reusable strings + - name: Set reusable strings (Windows) + if: matrix.os == 'windows-latest' + id: strings + shell: powershell + run: | + "build-output-dir=${{ github.workspace }}\build" >> $env:GITHUB_OUTPUT + + - name: Set reusable strings (Linux) + if: matrix.os == 'ubuntu-latest' id: strings shell: bash run: | @@ -103,7 +111,16 @@ jobs: } } - - name: Resolve actual compiler command + - name: Resolve actual compiler command (Windows) + if: matrix.os == 'windows-latest' + id: cc + shell: powershell + run: | + "c=${{ matrix.c_compiler }}" >> $env:GITHUB_OUTPUT + "cxx=${{ matrix.cpp_compiler }}" >> $env:GITHUB_OUTPUT + + - name: Resolve actual compiler command (Linux) + if: matrix.os == 'ubuntu-latest' id: cc shell: bash run: | From d80e95161fd671f43b82e5a7ac86c4976d63bc4d Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 19:39:54 +0200 Subject: [PATCH 09/13] ci: windows fixes / Signed-off-by: Dylan Hollemaert --- .github/workflows/ci.yml | 64 ++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ab1c2a..23e9775 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,14 +44,14 @@ jobs: - name: Set reusable strings (Windows) if: matrix.os == 'windows-latest' - id: strings + id: strings-windows shell: powershell run: | "build-output-dir=${{ github.workspace }}\build" >> $env:GITHUB_OUTPUT - name: Set reusable strings (Linux) if: matrix.os == 'ubuntu-latest' - id: strings + id: strings-linux shell: bash run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" @@ -111,28 +111,19 @@ jobs: } } - - name: Resolve actual compiler command (Windows) - if: matrix.os == 'windows-latest' - id: cc - shell: powershell - run: | - "c=${{ matrix.c_compiler }}" >> $env:GITHUB_OUTPUT - "cxx=${{ matrix.cpp_compiler }}" >> $env:GITHUB_OUTPUT - - - name: Resolve actual compiler command (Linux) - if: matrix.os == 'ubuntu-latest' - id: cc - shell: bash + - name: Check GCC + if: matrix.c_compiler == 'gcc' + shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} run: | - echo "c=${{ matrix.c_compiler }}" >> "$GITHUB_OUTPUT" - echo "cxx=${{ matrix.cpp_compiler }}" >> "$GITHUB_OUTPUT" + gcc --version + g++ --version - - name: Check compilers - if: matrix.c_compiler != 'cl' - shell: bash + - name: Check Clang + if: matrix.c_compiler == 'clang' + shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} run: | - ${{ steps.cc.outputs.c }} --version - ${{ steps.cc.outputs.cxx }} --version + clang --version + clang++ --version - name: Check MSVC if: matrix.c_compiler == 'cl' @@ -141,23 +132,44 @@ jobs: cl - name: Check CMake and Ninja + shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} run: | cmake --version ninja --version - name: Configure CMake + shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=${{ steps.cc.outputs.cxx }} - -DCMAKE_C_COMPILER=${{ steps.cc.outputs.c }} + cmake + -B ${{ + matrix.os == 'windows-latest' + && steps.strings-windows.outputs.build-output-dir + || steps.strings-linux.outputs.build-output-dir + }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DNEXUS_BUILD_TEST=ON -G Ninja -S ${{ github.workspace }} - name: Build - run: cmake --build "${{ steps.strings.outputs.build-output-dir }}" --config ${{ matrix.build_type }} + shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} + run: > + cmake + --build "${{ + matrix.os == 'windows-latest' + && steps.strings-windows.outputs.build-output-dir + || steps.strings-linux.outputs.build-output-dir + }}" + --config ${{ matrix.build_type }} - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }}/Tests + shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} + working-directory: > + ${{ + matrix.os == 'windows-latest' + && steps.strings-windows.outputs.build-output-dir + || steps.strings-linux.outputs.build-output-dir + }}/Tests run: ctest --build-config ${{ matrix.build_type }} From 8789dcab89ad519c3643bed0d734be014be4076b Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 19:47:09 +0200 Subject: [PATCH 10/13] ci: revamp, and it's not the last one Signed-off-by: Dylan Hollemaert --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23e9775..7645003 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CMake on multiple platforms on: push: - branches: [ "test-docker" ] + branches: ["test-docker"] pull_request: - branches: [ "master" ] + branches: ["master"] jobs: build: @@ -113,14 +113,12 @@ jobs: - name: Check GCC if: matrix.c_compiler == 'gcc' - shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} run: | gcc --version g++ --version - name: Check Clang if: matrix.c_compiler == 'clang' - shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} run: | clang --version clang++ --version @@ -132,44 +130,54 @@ jobs: cl - name: Check CMake and Ninja - shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} run: | cmake --version ninja --version - - name: Configure CMake - shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} + - name: Configure CMake (Linux) + if: matrix.os == 'ubuntu-latest' run: > cmake - -B ${{ - matrix.os == 'windows-latest' - && steps.strings-windows.outputs.build-output-dir - || steps.strings-linux.outputs.build-output-dir - }} + -B "${{ steps.strings-linux.outputs.build-output-dir }}" + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DNEXUS_BUILD_TEST=ON + -G Ninja + -S "${{ github.workspace }}" + + - name: Configure CMake (Windows) + if: matrix.os == 'windows-latest' + run: > + cmake + -B "${{ steps.strings-windows.outputs.build-output-dir }}" -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DNEXUS_BUILD_TEST=ON -G Ninja - -S ${{ github.workspace }} + -S "${{ github.workspace }}" - - name: Build - shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} + - name: Build (Linux) + if: matrix.os == 'ubuntu-latest' + run: > + cmake + --build "${{ steps.strings-linux.outputs.build-output-dir }}" + --config "${{ matrix.build_type }}" + + - name: Build (Windows) + if: matrix.os == 'windows-latest' run: > cmake - --build "${{ - matrix.os == 'windows-latest' - && steps.strings-windows.outputs.build-output-dir - || steps.strings-linux.outputs.build-output-dir - }}" - --config ${{ matrix.build_type }} - - - name: Test - shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} - working-directory: > - ${{ - matrix.os == 'windows-latest' - && steps.strings-windows.outputs.build-output-dir - || steps.strings-linux.outputs.build-output-dir - }}/Tests - run: ctest --build-config ${{ matrix.build_type }} + --build "${{ steps.strings-windows.outputs.build-output-dir }}" + --config "${{ matrix.build_type }}" + + - name: Test (Linux) + if: matrix.os == 'ubuntu-latest' + working-directory: "${{ steps.strings-linux.outputs.build-output-dir }}/Tests" + run: ctest --build-config "${{ matrix.build_type }}" + + - name: Test (Windows) + if: matrix.os == 'windows-latest' + working-directory: "${{ steps.strings-windows.outputs.build-output-dir }}/Tests" + run: ctest --build-config "${{ matrix.build_type }}" From 133f5c2f5fdd9703b8744f65288a1f6eee0a6322 Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 20:05:32 +0200 Subject: [PATCH 11/13] docker: rm local files Signed-off-by: Dylan Hollemaert --- .gitignore | 3 + DockerRunner/.gitignore | 2 - DockerRunner/Dockerfile | 83 --------------------------- DockerRunner/README.md | 78 ------------------------- DockerRunner/docker-compose.yml | 12 ---- DockerRunner/entrypoint.sh | 53 ----------------- DockerRunner/start-runner.ps1.example | 29 ---------- DockerRunner/stop-runner.ps1 | 10 ---- 8 files changed, 3 insertions(+), 267 deletions(-) delete mode 100644 DockerRunner/.gitignore delete mode 100644 DockerRunner/Dockerfile delete mode 100644 DockerRunner/README.md delete mode 100644 DockerRunner/docker-compose.yml delete mode 100644 DockerRunner/entrypoint.sh delete mode 100644 DockerRunner/start-runner.ps1.example delete mode 100644 DockerRunner/stop-runner.ps1 diff --git a/.gitignore b/.gitignore index 5bb2ee5..6270a22 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ vc140.pdb # Docs Docs/Generated_HTML/ + +# Local docker runner +LocalRunner/ diff --git a/DockerRunner/.gitignore b/DockerRunner/.gitignore deleted file mode 100644 index 7602b71..0000000 --- a/DockerRunner/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Contains your PAT filled in directly — never commit this -start-runner.ps1 diff --git a/DockerRunner/Dockerfile b/DockerRunner/Dockerfile deleted file mode 100644 index 3feabb2..0000000 --- a/DockerRunner/Dockerfile +++ /dev/null @@ -1,83 +0,0 @@ -FROM ubuntu:24.04 - -ENV DEBIAN_FRONTEND=noninteractive -ARG RUNNER_VERSION=2.337.0 - -ARG GCC_VERSION=16 -ARG LLVM_VERSION=22 - -# APT Packages -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - unzip \ - git \ - mingw-w64 \ - ca-certificates \ - curl \ - gnupg \ - lsb-release \ - software-properties-common \ - wget \ - jq \ - sudo \ - libicu-dev \ - libwayland-dev \ - pkg-config \ - libx11-dev \ - libxrandr-dev \ - libxinerama-dev \ - libxcursor-dev \ - libxi-dev \ - libxkbcommon-dev \ - wayland-protocols \ - && rm -rf /var/lib/apt/lists/* - -# Ninja -RUN wget -q https://github.com/ninja-build/ninja/releases/download/v1.13.2/ninja-linux.zip \ - && unzip ninja-linux.zip -d /usr/local/bin \ - && chmod +x /usr/local/bin/ninja \ - && rm ninja-linux.zip - -# CMake -RUN wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc \ - | gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg && \ - echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main" \ - > /etc/apt/sources.list.d/kitware.list && \ - apt-get update && \ - apt-get install -y --no-install-recommends cmake && \ - rm -rf /var/lib/apt/lists/* - -# GCC version ${GCC_VERSION} -RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - gcc-${GCC_VERSION} g++-${GCC_VERSION} && \ - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 && \ - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 && \ - rm -rf /var/lib/apt/lists/* - -# LLVM version ${LLVM_VERSION} -RUN wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh && \ - chmod +x /tmp/llvm.sh && \ - /tmp/llvm.sh ${LLVM_VERSION} all && \ - update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 && \ - update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100 && \ - rm -f /tmp/llvm.sh && \ - rm -rf /var/lib/apt/lists/* - -# GitHub Actions runner download -RUN useradd -m runner && \ - mkdir -p /home/runner/actions-runner && \ - cd /home/runner/actions-runner && \ - curl -o actions-runner.tar.gz -L \ - "https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz" && \ - tar xzf actions-runner.tar.gz && \ - rm actions-runner.tar.gz && \ - ./bin/installdependencies.sh && \ - chown -R runner:runner /home/runner/actions-runner - -USER runner -WORKDIR /home/runner/actions-runner - -COPY --chown=runner:runner entrypoint.sh /home/runner/entrypoint.sh -ENTRYPOINT ["/home/runner/entrypoint.sh"] diff --git a/DockerRunner/README.md b/DockerRunner/README.md deleted file mode 100644 index 25b1b85..0000000 --- a/DockerRunner/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Self-hosted GitHub Actions runner (Docker, Windows) - -Makes your `git push` / PRs trigger a real job that runs on your machine, -inside Docker, and shows up in the repo's **Actions** tab exactly like a -GitHub-hosted run would. - -## Limitation, stated plainly - -This runner is a Linux container (Docker Desktop on Windows runs Linux -containers via WSL2). It can genuinely execute the `ubuntu-latest` + -gcc/clang matrix legs. It **cannot** become real Windows/MSVC — `cl` isn't -installable or runnable inside a Linux container, regardless of the host -OS. The provided `ci.yml` handles the `windows-latest`/`cl` leg as a -mingw-w64 cross-compile (build-only, no test execution) on this same -container, and labels it as such in the job output. - -## One-time setup - -1. **Docker Desktop** — confirm it's running (you said it's already - installed, good). - -2. **Fine-grained PAT**: GitHub -> avatar -> Settings -> Developer settings -> - Personal access tokens -> Fine-grained tokens -> Generate new token. - Scope to this repo only, permission: **Administration: Read and write**. - -3. Copy `start-runner.ps1.example` to `start-runner.ps1` and fill in your - three values (`GH_PAT`, `GH_OWNER`, `GH_REPO`): - ```powershell - Copy-Item start-runner.ps1.example start-runner.ps1 - notepad start-runner.ps1 - ``` - `start-runner.ps1` is gitignored -- it holds your real token, never commit it. - -4. Replace your repo's `.github\workflows\ci.yml` with the one provided - earlier (or merge the `runs-on` / matrix changes into your existing one). - -## Running the runner - -From PowerShell, in this folder: - -```powershell -.\start-runner.ps1 -``` - -First run may prompt an execution-policy warning. If PowerShell refuses to -run the script, either right-click the file -> "Run with PowerShell", or run -once per session: -```powershell -Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -``` - -This builds the image, registers the container as a runner against your -repo, and leaves it running in the background. Check GitHub -> repo -> -**Settings -> Actions -> Runners** -- it should show as **Idle**. - -Push a commit or open a PR -- the run appears in the **Actions** tab as -normal, executing on your container. - -Stop it (also deregisters automatically): -```powershell -.\stop-runner.ps1 -``` - -View live logs any time: -```powershell -docker compose logs -f -``` - -## Notes - -- Runner labels: `docker-local, linux-x64, self-hosted` -- `ci.yml`'s - `runs-on: [self-hosted, docker-local, linux-x64]` targets exactly this - container. -- `restart: unless-stopped` in `docker-compose.yml` means Docker Desktop - restarting (e.g. after your PC reboots) brings the runner back up and it - re-registers automatically. -- The runner checks out your repo itself per-job over the network -- no - local repo path or bind mount needed. diff --git a/DockerRunner/docker-compose.yml b/DockerRunner/docker-compose.yml deleted file mode 100644 index 3ac2b76..0000000 --- a/DockerRunner/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -services: - gh-runner: - build: . - environment: - - GH_PAT=${GH_PAT} - - GH_OWNER=${GH_OWNER} - - GH_REPO=${GH_REPO} - - RUNNER_NAME=docker-local-runner - - RUNNER_LABELS=docker-local,linux-x64,self-hosted - restart: unless-stopped - # runner needs to check out your repo itself (GitHub tells it what to - # check out), so no source bind-mount needed here like the old setup diff --git a/DockerRunner/entrypoint.sh b/DockerRunner/entrypoint.sh deleted file mode 100644 index e15e818..0000000 --- a/DockerRunner/entrypoint.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Required env vars: -# GH_PAT - fine-grained PAT scoped to this repo, "Administration: read & write" -# GH_OWNER - e.g. "dylan" -# GH_REPO - e.g. "nexus" -# -# Optional: -# RUNNER_NAME - defaults to hostname -# RUNNER_LABELS - defaults to "docker-local,linux-x64" - -: "${GH_PAT:?Set GH_PAT to a fine-grained PAT with Administration: read/write on the repo}" -: "${GH_OWNER:?Set GH_OWNER (e.g. your github username or org)}" -: "${GH_REPO:?Set GH_REPO (repo name, no owner prefix)}" - -RUNNER_NAME="${RUNNER_NAME:-$(hostname)}" -RUNNER_LABELS="${RUNNER_LABELS:-docker-local,linux-x64}" - -API="https://api.github.com/repos/${GH_OWNER}/${GH_REPO}" - -echo "==> Requesting runner registration token from GitHub..." -REG_TOKEN=$(curl -sX POST \ - -H "Authorization: Bearer ${GH_PAT}" \ - -H "Accept: application/vnd.github+json" \ - "${API}/actions/runners/registration-token" | jq -r .token) - -if [[ -z "$REG_TOKEN" || "$REG_TOKEN" == "null" ]]; then - echo "Failed to get registration token. Check GH_PAT permissions and GH_OWNER/GH_REPO." >&2 - exit 1 -fi - -echo "==> Configuring runner '${RUNNER_NAME}' with labels [${RUNNER_LABELS}]..." -./config.sh \ - --url "https://github.com/${GH_OWNER}/${GH_REPO}" \ - --token "${REG_TOKEN}" \ - --name "${RUNNER_NAME}" \ - --labels "${RUNNER_LABELS}" \ - --unattended \ - --replace - -cleanup() { - echo "==> Deregistering runner..." - REMOVE_TOKEN=$(curl -sX POST \ - -H "Authorization: Bearer ${GH_PAT}" \ - -H "Accept: application/vnd.github+json" \ - "${API}/actions/runners/remove-token" | jq -r .token) - ./config.sh remove --token "${REMOVE_TOKEN}" || true -} -trap cleanup EXIT INT TERM - -echo "==> Starting runner..." -./run.sh diff --git a/DockerRunner/start-runner.ps1.example b/DockerRunner/start-runner.ps1.example deleted file mode 100644 index fcbe8fc..0000000 --- a/DockerRunner/start-runner.ps1.example +++ /dev/null @@ -1,29 +0,0 @@ -# start-runner.ps1 -# Sets up env vars and starts the self-hosted GitHub Actions runner in Docker. -# -# Usage: -# 1. Fill in the three values below (or set them once via $env: before running this script) -# 2. Right-click > Run with PowerShell, OR from a PowerShell prompt: .\start-runner.ps1 -# -# Requires: Docker Desktop running. - -# --- Fill these in --------------------------------------------------------- -$env:GH_PAT = "github_pat_xxxxxxxx" # your fine-grained PAT -$env:GH_OWNER = "your-username" # your GitHub username or org -$env:GH_REPO = "your-repo-name" # repo name only, no owner prefix -# ----------------------------------------------------------------------- - -if ($env:GH_PAT -eq "github_pat_xxxxxxxx") { - Write-Host "Edit start-runner.ps1 and fill in GH_PAT, GH_OWNER, GH_REPO first." -ForegroundColor Red - exit 1 -} - -Write-Host "==> Building and starting the runner container..." -ForegroundColor Cyan -docker compose up --build -d - -if ($LASTEXITCODE -eq 0) { - Write-Host "==> Runner starting. Check GitHub -> repo -> Settings -> Actions -> Runners for 'Idle' status." -ForegroundColor Green - Write-Host "==> View logs with: docker compose logs -f" -ForegroundColor Yellow -} else { - Write-Host "==> docker compose failed, see output above." -ForegroundColor Red -} diff --git a/DockerRunner/stop-runner.ps1 b/DockerRunner/stop-runner.ps1 deleted file mode 100644 index 2e04363..0000000 --- a/DockerRunner/stop-runner.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -# stop-runner.ps1 -# Stops the runner container. The container's own trap (in entrypoint.sh) -# deregisters it from GitHub automatically as it shuts down. -# -# Usage: .\stop-runner.ps1 - -Write-Host "==> Stopping runner container..." -ForegroundColor Cyan -docker compose down - -Write-Host "==> Done. Check GitHub -> repo -> Settings -> Actions -> Runners to confirm it's gone." -ForegroundColor Green From 28aca9b1932f02a350419c0c48a444ed9e400550 Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 21:35:13 +0200 Subject: [PATCH 12/13] ci: last simplification before merge Signed-off-by: Dylan Hollemaert --- .github/workflows/ci.yml | 55 +++++----------------------------------- 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7645003..e3cbcc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,21 +40,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 - - - name: Set reusable strings (Windows) - if: matrix.os == 'windows-latest' - id: strings-windows - shell: powershell - run: | - "build-output-dir=${{ github.workspace }}\build" >> $env:GITHUB_OUTPUT - - - name: Set reusable strings (Linux) - if: matrix.os == 'ubuntu-latest' - id: strings-linux - shell: bash - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + uses: actions/checkout@v6 - name: Setup MSVC if: matrix.os == 'windows-latest' && matrix.c_compiler == 'cl' @@ -134,23 +120,10 @@ jobs: cmake --version ninja --version - - name: Configure CMake (Linux) - if: matrix.os == 'ubuntu-latest' - run: > - cmake - -B "${{ steps.strings-linux.outputs.build-output-dir }}" - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -DNEXUS_BUILD_TEST=ON - -G Ninja - -S "${{ github.workspace }}" - - - name: Configure CMake (Windows) - if: matrix.os == 'windows-latest' + - name: Configure CMake run: > cmake - -B "${{ steps.strings-windows.outputs.build-output-dir }}" + -B "${{ github.workspace }}/build" -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} @@ -158,26 +131,12 @@ jobs: -G Ninja -S "${{ github.workspace }}" - - name: Build (Linux) - if: matrix.os == 'ubuntu-latest' - run: > - cmake - --build "${{ steps.strings-linux.outputs.build-output-dir }}" - --config "${{ matrix.build_type }}" - - - name: Build (Windows) - if: matrix.os == 'windows-latest' + - name: Build run: > cmake - --build "${{ steps.strings-windows.outputs.build-output-dir }}" + --build "${{ github.workspace }}/build" --config "${{ matrix.build_type }}" - - name: Test (Linux) - if: matrix.os == 'ubuntu-latest' - working-directory: "${{ steps.strings-linux.outputs.build-output-dir }}/Tests" - run: ctest --build-config "${{ matrix.build_type }}" - - - name: Test (Windows) - if: matrix.os == 'windows-latest' - working-directory: "${{ steps.strings-windows.outputs.build-output-dir }}/Tests" + - name: Test + working-directory: "${{ github.workspace }}/build/Tests" run: ctest --build-config "${{ matrix.build_type }}" From ff755788e551963276b1f57c9a6b37145b2472c8 Mon Sep 17 00:00:00 2001 From: Dylan Hollemaert Date: Thu, 27 Aug 2026 21:46:27 +0200 Subject: [PATCH 13/13] add: Locally run github actions CI pipeline. * CD coming when the engine is good enough to have releases. Signed-off-by: Dylan Hollemaert --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3cbcc2..31d1d6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,8 @@ -name: CMake on multiple platforms +name: NexusEngine / CMake on multiple platforms on: push: - branches: ["test-docker"] + branches: ["master"] pull_request: branches: ["master"]