add woodpecker pipelines
This commit is contained in:
@@ -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
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
when:
|
||||||
|
event: [push, pull_request]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
fmt:
|
||||||
|
image: rust:1
|
||||||
|
commands:
|
||||||
|
- cargo fmt --all -- --check
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
when:
|
||||||
|
event: [push, pull_request]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
test:
|
||||||
|
image: rust:1
|
||||||
|
commands:
|
||||||
|
- cargo test --all
|
||||||
@@ -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
|
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`.
|
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
|
```sh
|
||||||
# one-time setup
|
# one-time setup
|
||||||
|
cargo build
|
||||||
cd e2e
|
cd e2e
|
||||||
npm install
|
npm install
|
||||||
npx playwright install chromium
|
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
|
cd e2e
|
||||||
npx playwright test
|
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.
|
|
||||||
|
|||||||
@@ -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",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ export default defineConfig({
|
|||||||
testDir: "./tests",
|
testDir: "./tests",
|
||||||
timeout: 30_000,
|
timeout: 30_000,
|
||||||
retries: 0,
|
retries: 0,
|
||||||
globalSetup: "./global-setup.ts",
|
|
||||||
use: {
|
use: {
|
||||||
trace: "on-first-retry",
|
trace: "on-first-retry",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user