Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

79 lines · 3.3 KBRaw History
1name: End-to-end
2
3on:
4 push:
5 branches: [main]
6 pull_request:
7
8permissions:
9 contents: read
10
11concurrency:
12 group: e2e-${{ github.ref }}
13 cancel-in-progress: true
14
15jobs:
16 # The suite in parallel shards of about the same length: the git, pull request and
17 # Actions file split in two (its large pushes on their own), agents, security, and
18 # every other test/e2e/*.test.mjs file (so a new file runs without editing this).
19 # Only the last shard needs a browser (passkeys).
20 e2e:
21 name: End-to-end (${{ matrix.name }})
22 runs-on: ubuntu-latest
23 timeout-minutes: 20
24 strategy:
25 fail-fast: false
26 matrix:
27 include:
28 - name: git, PRs, Actions
29 shard: core
30 - name: large pushes, real histories
31 shard: large
32 - name: agent reviews, tasks, Today
33 shard: agents
34 - name: security
35 shard: security
36 - name: passkeys, registry, email
37 shard: rest
38 steps:
39 - uses: actions/checkout@v4
40 - uses: pnpm/action-setup@v4
41 - uses: actions/setup-node@v4
42 with:
43 node-version: 22
44 cache: pnpm
45 - run: pnpm install --frozen-lockfile
46 - run: pnpm -r --if-present build
47 - if: matrix.shard == 'rest'
48 run: pnpm --filter @diffinery/app exec playwright install --with-deps chromium
49 # Agent runs (terminal tasks, and headless runs in the agents shard) are in a bubblewrap jail
50 # (containers/runner/src/jail.ts); Ubuntu's AppArmor otherwise keeps
51 # it from creating user namespaces. Diffinery's own runner image already has bwrap and no sudo, running as root.
52 - if: matrix.shard == 'rest' || matrix.shard == 'agents'
53 run: |
54 as_root() { if [ "$(id -u)" = 0 ]; then "$@"; else sudo "$@"; fi; }
55 if ! command -v bwrap >/dev/null; then
56 as_root apt-get install -y --no-install-recommends bubblewrap || { as_root apt-get update -qq && as_root apt-get install -y --no-install-recommends bubblewrap; }
57 fi
58 as_root sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 2>/dev/null || true
59 bwrap --unshare-all --ro-bind / / --dev /dev --proc /proc -- true
60 - name: Run the shard's tests
61 working-directory: apps/diffinery
62 run: |
63 # Shards of similar length; a new test file runs in "rest" unless it's added to another.
64 core='/e2e\.test\.mjs$'
65 agents='/(agentic|review|tasks)\.test\.mjs$'
66 security='/(security|status)\.test\.mjs$'
67 # The core file's large pushes and real histories take minutes each: their own shard, so
68 # neither half runs into the per-file timeout.
69 large='^(real histories|large files|large pushes):'
70 opts=(--test-timeout=600000)
71 case "${{ matrix.shard }}" in
72 core) files=$(ls test/e2e/*.test.mjs | grep -E "$core"); opts+=(--test-skip-pattern="$large") ;;
73 large) files=$(ls test/e2e/*.test.mjs | grep -E "$core"); opts+=(--test-name-pattern="$large") ;;
74 agents) files=$(ls test/e2e/*.test.mjs | grep -E "$agents") ;;
75 security) files=$(ls test/e2e/*.test.mjs | grep -E "$security") ;;
76 *) files=$(ls test/e2e/*.test.mjs | grep -vE "$core|$agents|$security") ;;
77 esac
78 echo "$files"
79 node --test --test-concurrency=1 "${opts[@]}" $files