|
6 | 6 |
|
7 | 7 | const repo = "Defelo/nixpkgs-review-gha"; |
8 | 8 |
|
9 | | -const reviewDefaults = ({ title, commits, labels, author, authoredByMe, hasLinuxRebuilds, hasDarwinRebuilds }) => { |
10 | | - const darwinSandbox = "relaxed"; |
| 9 | +const reviewDefaults = ({ |
| 10 | + title, |
| 11 | + commits, |
| 12 | + labels, |
| 13 | + author, |
| 14 | + authoredByMe, |
| 15 | + hasLinuxRebuilds, |
| 16 | + hasDarwinRebuilds, |
| 17 | + state, |
| 18 | +}) => { |
| 19 | + const darwinSandboxFalseList = ["miniserve", "radicle-ci-broker"]; |
| 20 | + const darwinSandboxRelaxedList = ["jujutsu", "smtp4dev"]; |
| 21 | + const x8664DarwinSkipList = []; |
| 22 | + |
| 23 | + const testMap = [[["radicle-ci-broker", "radicle-native-ci", "radicle-job"], "nixosTests.radicle-ci-broker"]]; |
| 24 | + const testPackages = [ |
| 25 | + "alertmanager-ntfy", |
| 26 | + "anubis", |
| 27 | + "chhoto-url", |
| 28 | + "echoip", |
| 29 | + "glitchtip", |
| 30 | + "go-httpbin", |
| 31 | + "olivetin", |
| 32 | + "privatebin", |
| 33 | + "radicle-node", |
| 34 | + "taplo", |
| 35 | + "uiua", |
| 36 | + "uiua-unstable", |
| 37 | + "whoami", |
| 38 | + "zipline", |
| 39 | + ]; |
| 40 | + |
| 41 | + const skipMap = [[["taplo"], "servo"]]; |
| 42 | + |
| 43 | + const pkgsChanged = pkgs => pkgs.some(p => commits.some(({ subject }) => subject.startsWith(`${p}:`))); |
| 44 | + |
| 45 | + const extraPkgs = new Set( |
| 46 | + testMap |
| 47 | + .filter(([pkgs]) => pkgsChanged(pkgs)) |
| 48 | + .map(([, test]) => test) |
| 49 | + .concat(testPackages.filter(pkg => pkgsChanged([pkg])).map(pkg => `${pkg}.tests`)), |
| 50 | + ); |
| 51 | + |
| 52 | + const skipPkgs = new Set( |
| 53 | + skipMap.filter(([pkgs, skip]) => pkgsChanged(pkgs) && !pkgsChanged([skip])).map(([, skip]) => skip), |
| 54 | + ); |
| 55 | + |
| 56 | + const darwinSandbox = pkgsChanged(darwinSandboxFalseList) |
| 57 | + ? "false" |
| 58 | + : pkgsChanged(darwinSandboxRelaxedList) |
| 59 | + ? "relaxed" |
| 60 | + : true; |
11 | 61 |
|
12 | 62 | const hasRebuilds = hasLinuxRebuilds || hasDarwinRebuilds; |
13 | 63 |
|
14 | 64 | return { |
15 | | - // "branch": "main", |
| 65 | + branch: "private", |
16 | 66 | "x86_64-linux": !hasRebuilds || hasLinuxRebuilds, |
17 | 67 | "aarch64-linux": !hasRebuilds || hasLinuxRebuilds, |
18 | | - "x86_64-darwin": !hasRebuilds || hasDarwinRebuilds ? `yes_sandbox_${darwinSandbox}` : "no", |
| 68 | + "x86_64-darwin": |
| 69 | + !hasRebuilds || (hasDarwinRebuilds && !pkgsChanged(x8664DarwinSkipList)) ? `yes_sandbox_${darwinSandbox}` : "no", |
19 | 70 | "aarch64-darwin": !hasRebuilds || hasDarwinRebuilds ? `yes_sandbox_${darwinSandbox}` : "no", |
20 | | - // "extra-args": "", |
| 71 | + "extra-args": [...extraPkgs] |
| 72 | + .map(pkg => `-a ${pkg}`) |
| 73 | + .concat([...skipPkgs].map(pkg => `--skip-package ${pkg}`)) |
| 74 | + .join(" "), |
21 | 75 | // "push-to-cache": true, |
22 | 76 | // "upterm": false, |
23 | 77 | // "post-result": true, |
24 | | - // "on-success": "nothing", |
| 78 | + "on-success": state === "DRAFT" ? "mark_as_ready" : "nothing", |
25 | 79 | }; |
26 | 80 | }; |
27 | 81 |
|
|
0 commit comments