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.

70 lines · 2.7 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 two parallel shards of about the same length: the git, pull request
17 # and Actions file on its own, and every other test/e2e/*.test.mjs file (so a new
18 # file runs without editing this). Only the second shard needs a browser (passkeys).
19 e2e:
20 name: End-to-end (${{ matrix.name }})
21 runs-on: ubuntu-latest
22 timeout-minutes: 20
23 strategy:
24 fail-fast: false
25 matrix:
26 include:
27 - name: git, PRs, Actions
28 shard: core
29 - name: agent reviews, tasks, Today
30 shard: agents
31 - name: security
32 shard: security
33 - name: passkeys, registry, email
34 shard: rest
35 steps:
36 - uses: actions/checkout@v4
37 - uses: pnpm/action-setup@v4
38 - uses: actions/setup-node@v4
39 with:
40 node-version: 22
41 cache: pnpm
42 - run: pnpm install --frozen-lockfile
43 - run: pnpm -r --if-present build
44 - if: matrix.shard == 'rest'
45 run: pnpm --filter @diffinery/app exec playwright install --with-deps chromium
46 # Terminal tasks run in a bubblewrap jail (containers/runner/src/jail.ts); Ubuntu's AppArmor otherwise keeps
47 # it from creating user namespaces. Diffinery's own runner image already has bwrap and no sudo, running as root.
48 - if: matrix.shard == 'rest'
49 run: |
50 as_root() { if [ "$(id -u)" = 0 ]; then "$@"; else sudo "$@"; fi; }
51 if ! command -v bwrap >/dev/null; then
52 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; }
53 fi
54 as_root sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 2>/dev/null || true
55 bwrap --unshare-all --ro-bind / / --dev /dev --proc /proc -- true
56 - name: Run the shard's tests
57 working-directory: apps/diffinery
58 run: |
59 # Shards of similar length; a new test file runs in "rest" unless it's added to another.
60 core='/e2e\.test\.mjs$'
61 agents='/(agentic|review|tasks)\.test\.mjs$'
62 security='/security\.test\.mjs$'
63 case "${{ matrix.shard }}" in
64 core) files=$(ls test/e2e/*.test.mjs | grep -E "$core") ;;
65 agents) files=$(ls test/e2e/*.test.mjs | grep -E "$agents") ;;
66 security) files=$(ls test/e2e/*.test.mjs | grep -E "$security") ;;
67 *) files=$(ls test/e2e/*.test.mjs | grep -vE "$core|$agents|$security") ;;
68 esac
69 echo "$files"
70 node --test --test-concurrency=1 --test-timeout=600000 $files