Skip to content

Commit 9d34651

Browse files
committed
add dev workflow
1 parent 3dcc8bc commit 9d34651

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
result
22
result-*
33

4+
.buildbot-dev
5+
46
# Byte-compiled / optimized / DLL files
57
__pycache__/
68
*.py[cod]

packages/buildbot-dev.nix

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
writeShellScriptBin,
3+
python,
4+
buildbot,
5+
buildbot-worker,
6+
buildbot-nix,
7+
buildbot-gitea,
8+
buildbot-effects,
9+
buildbot-plugins,
10+
}:
11+
let
12+
pythonEnv = python.withPackages (ps: [
13+
ps.twisted
14+
(ps.toPythonModule buildbot)
15+
(ps.toPythonModule buildbot-worker)
16+
buildbot-nix
17+
buildbot-gitea
18+
buildbot-effects
19+
buildbot-plugins.www
20+
]);
21+
in
22+
writeShellScriptBin "buildbot-dev" ''
23+
set -xeuo pipefail
24+
git_root=$(git rev-parse --show-toplevel)
25+
mkdir -p "$git_root/.buildbot-dev"
26+
cd "$git_root/.buildbot-dev"
27+
"${pythonEnv}/bin/buildbot" create-master .
28+
#if [ ! -f master.cfg ]; then
29+
install -m600 ${./master.cfg.py} master.cfg
30+
#fi
31+
echo > $git_root/.buildbot-dev/twistd.log
32+
tail -f $git_root/.buildbot-dev/twistd.log &
33+
tail_pid=$!
34+
trap 'kill $tail_pid' EXIT
35+
"${pythonEnv}/bin/buildbot" start --nodaemon .
36+
''

packages/flake-module.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@
33
{
44
lib,
55
pkgs,
6+
self',
67
...
78
}:
89
{
910
packages =
1011
{
1112
# useful for checking what buildbot version is used.
1213
buildbot = pkgs.callPackage ./buildbot.nix { };
14+
buildbot-dev = pkgs.python3.pkgs.callPackage ./buildbot-dev.nix {
15+
inherit (self'.packages)
16+
buildbot-gitea
17+
buildbot-effects
18+
buildbot-nix
19+
buildbot
20+
;
21+
inherit (pkgs) buildbot-worker buildbot-plugins;
22+
};
1323
buildbot-nix = pkgs.python3.pkgs.callPackage ./buildbot-nix.nix { };
1424
buildbot-gitea = pkgs.python3.pkgs.callPackage ./buildbot-gitea.nix {
1525
buildbot = pkgs.buildbot;

packages/master.cfg.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from pathlib import Path
2+
from buildbot_nix import (
3+
NixConfigurator,
4+
BuildbotNixConfig,
5+
)
6+
from buildbot.process.factory import BuildFactory
7+
8+
factory = BuildFactory()
9+
10+
STATE_DIR = Path(".")
11+
PORT = 8012
12+
13+
buildbot_nix_config = BuildbotNixConfig(
14+
db_url="sqlite:///state.sqlite",
15+
pull_based=dict(
16+
repositories={
17+
"buildbot-nix": dict(
18+
name="buildbot-nix",
19+
url="https://github.com/nix-community/buildbot-nix",
20+
default_branch="main",
21+
)
22+
},
23+
poll_spread=None,
24+
),
25+
build_systems=["x86_64-linux"],
26+
eval_max_memory_size=4096,
27+
eval_worker_count=4,
28+
local_workers=4,
29+
domain="localhost",
30+
webhook_base_url=f"http://localhost:{PORT}",
31+
url=f"http://localhost:{PORT}",
32+
)
33+
34+
c = BuildmasterConfig = dict(
35+
title="Hello World CI",
36+
titleURL="https://buildbot.github.io/hello-world/",
37+
configurators=[
38+
NixConfigurator(buildbot_nix_config),
39+
],
40+
protocols={"pb": {"port": "tcp:9989:interface=\\:\\:1"}},
41+
www=dict(port=PORT, plugins=dict()),
42+
)

0 commit comments

Comments
 (0)