From 0324a9774809eb24bf82f0f2c87fefdc21a1048f Mon Sep 17 00:00:00 2001 From: Simon Bernier St-Pierre Date: Sat, 1 Aug 2026 21:47:06 -0400 Subject: [PATCH] add woodpecker pipelines --- .woodpecker/e2e.yml | 16 ++++++++++++++++ .woodpecker/fmt.yml | 8 ++++++++ .woodpecker/test.yml | 8 ++++++++ README.md | 9 ++++----- e2e/global-setup.ts | 13 ------------- e2e/playwright.config.ts | 1 - 6 files changed, 36 insertions(+), 19 deletions(-) create mode 100644 .woodpecker/e2e.yml create mode 100644 .woodpecker/fmt.yml create mode 100644 .woodpecker/test.yml delete mode 100644 e2e/global-setup.ts diff --git a/.woodpecker/e2e.yml b/.woodpecker/e2e.yml new file mode 100644 index 0000000..bc52cc5 --- /dev/null +++ b/.woodpecker/e2e.yml @@ -0,0 +1,16 @@ +when: + event: [push, pull_request] + +steps: + e2e-build: + image: rust:1 + commands: + - cargo build + + e2e-test: + image: node:24 + commands: + - apt-get update + - apt-get install -y --no-install-recommends ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 xdg-utils + - cd e2e && npm install && npx playwright install chromium + - cd e2e && npx playwright test diff --git a/.woodpecker/fmt.yml b/.woodpecker/fmt.yml new file mode 100644 index 0000000..3604b7b --- /dev/null +++ b/.woodpecker/fmt.yml @@ -0,0 +1,8 @@ +when: + event: [push, pull_request] + +steps: + fmt: + image: rust:1 + commands: + - cargo fmt --all -- --check diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 0000000..8379f98 --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,8 @@ +when: + event: [push, pull_request] + +steps: + test: + image: rust:1 + commands: + - cargo test --all diff --git a/README.md b/README.md index af28b72..1fa999f 100644 --- a/README.md +++ b/README.md @@ -69,17 +69,16 @@ The e2e tests live in `e2e/` and use Playwright with a real browser. Each test starts its own server against a fresh, throwaway database on a unique port, so tests are fully isolated from each other and from your real `sustenance.db`. +The tests launch `target/debug/sustenance`, so build the server first: + ```sh # one-time setup +cargo build cd e2e npm install npx playwright install chromium -# run the tests (builds the server automatically via globalSetup) +# run the tests (each test launches its own server against a fresh DB) cd e2e npx playwright test ``` - -The Playwright `globalSetup` runs `cargo build` before the suite, and each test -launches its own server against a fresh database, so no manual build or server -start is required. diff --git a/e2e/global-setup.ts b/e2e/global-setup.ts deleted file mode 100644 index 793eba6..0000000 --- a/e2e/global-setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { execSync } from "child_process"; -import * as path from "path"; - -/** - * Builds the Rust server before the test suite runs, so the fixture can launch - * `target/debug/sustenance` without requiring a manual `cargo build`. - */ -export default function globalSetup() { - execSync("cargo build", { - cwd: path.resolve(__dirname, ".."), - stdio: "inherit", - }); -} diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts index e20cac1..eb71193 100644 --- a/e2e/playwright.config.ts +++ b/e2e/playwright.config.ts @@ -4,7 +4,6 @@ export default defineConfig({ testDir: "./tests", timeout: 30_000, retries: 0, - globalSetup: "./global-setup.ts", use: { trace: "on-first-retry", },