postjevsql.git / mise.toml
1# The toolchain, the environment and the tasks of this repository: the one place
2# every tool version lives. Nothing here needs nix, nix-darwin or root:
3#
4#     mise trust && mise install      the toolchain (git and curl must exist)
5#     mise tasks                      what can be run
6#     mise run check                  the fast gates (no database, no network)
7#     mise run test                   the whole suite through buck2, on Postgres 17 and 18
8#
9# `tools/check-versions.sh` (part of `mise run check`) fails when a version written
10# elsewhere (the PostgreSQL majors in build/defs.bzl, pgrx's pin, hk.pkl's hk release)
11# differs from the one here. The nix flake only wraps this file; it holds no version of its own.
12min_version = "2026.10.0"
13
14[tools]
15# The compiler the buck toolchain drives. rustfmt formats pgrx-pg-sys's generated bindings.
16rust = { version = "1.98.1", profile = "minimal", components = "rustfmt,clippy" }
17
18# buck2 owns the target graph. Pinned to a release: upstream replaces the assets of its "latest"
19# tag in place. 2026-09-15 is the first release with the h2 window fix the test suite needs
20# (tests/CLAUDE.md), and the one nix-pkgs carries.
21buck2 = "2026-09-15"
22
23# The prelude's python toolchain interpreter.
24python = "3.14.7"
25
26# A server of every supported major (PG_MAJORS in build/defs.bzl): each test starts a throwaway
27# one, and bindgen reads each major's headers through its pg_config. Prebuilt, from conda-forge.
28"conda:postgresql" = ["17.11", "18.6"]
29
30# The C and C++ toolchain, self-contained (it carries its own sysroot, linker and archiver, so the
31# machine needs no compiler), and libclang for pgrx-pg-sys's bindgen.
32"conda:clang" = "23.1.2"
33"conda:libclang" = "23.1.2"
34
35# `mise run pgrx:install`: build the extension with cargo into a Postgres you already run.
36"cargo:cargo-pgrx" = "0.19.2"
37
38# The jdx tools: git hooks, secrets.
39hk = "2.5.0"
40pkl = "0.32.1"
41fnox = "1.36.0"
42
43[env]
44# pgrx-pg-sys runs bindgen over each major's server headers, and bindgen needs libclang, the C headers clang
45# ships and a libc sysroot. buck2 passes its own environment to the build scripts it runs, so these are
46# set here, pointing at conda-forge's clang and libclang where mise installed them. tools/bindgen-shim holds the
47# one header conda-forge's PostgreSQL 18 asks for that its sysroot no longer has.
48LIBCLANG_PATH = "{{ env.MISE_DATA_DIR | default(value=xdg_data_home ~ '/mise') }}/installs/conda-libclang/23.1.2/lib"
49BINDGEN_EXTRA_CLANG_ARGS = "--sysroot={{ env.MISE_DATA_DIR | default(value=xdg_data_home ~ '/mise') }}/installs/conda-clang/23.1.2/x86_64-conda-linux-gnu/sysroot -isystem {{ env.MISE_DATA_DIR | default(value=xdg_data_home ~ '/mise') }}/installs/conda-clang/23.1.2/lib/clang/23/include -isystem {{ config_root }}/tools/bindgen-shim"
50# Only for `mise run gates:record`; a secret, so never written here (see fnox.toml):
51#   TYPESAFE_API_KEY
52
53# ---------------------------------------------------------------- setup
54
55[tasks.submodules]
56description = "Fetch the git submodules (third-party/jevcrates)"
57run = "git submodule update --init --recursive"
58
59[tasks.configure]
60description = "Write .buckconfig.local: the paths of the C toolchain, python, rustc and each Postgres major"
61run = '''
62POSTJEVSQL_PG_17="$(mise where conda:postgresql@17.11)" \
63POSTJEVSQL_PG_18="$(mise where conda:postgresql@18.6)" \
64tools/configure.sh
65'''
66
67[tasks."hooks:install"]
68description = "Install the git hooks (hk.pkl): the pure crates' tests before a push"
69run = "hk install"
70
71# ---------------------------------------------------------------- checks
72
73[tasks."check-versions"]
74description = "Fail if a version written outside mise.toml differs from it"
75run = "tools/check-versions.sh"
76
77[tasks."test:core"]
78description = "The crates that do no I/O (postjevsql-core, postjevsql-sidecar), natively with cargo: no database, no network, about a second"
79run = "cargo test -p postjevsql-core -p postjevsql-sidecar"
80
81[tasks.check]
82description = "The fast gates: versions and the crates that need no database"
83depends = ["check-versions", "test:core"]
84
85# ---------------------------------------------------------------- build and test (buck2)
86
87[tasks.build]
88description = "Build the extension with buck2 for the newest major (the install tree: lib/postjevsql.so, the control file, the install SQL)"
89depends = ["configure"]
90run = "buck2 build //crates/postjevsql:ext"
91
92[tasks."build:pg17"]
93description = "Build the extension for Postgres 17"
94depends = ["configure"]
95run = "buck2 build //crates/postjevsql:ext --target-platforms //platforms:pg17"
96
97[tasks.test]
98description = "The whole suite through buck2: every unit and integration test, on Postgres 17 and 18 (a cold run takes about 14 minutes on 3 cores)"
99run = "tests/run-check.sh"
100
101[tasks."test:buck"]
102description = "buck2 test //... directly, with no lock (use test: it queues checks that share this checkout's buck daemon)"
103depends = ["configure"]
104run = "buck2 test //..."
105
106[tasks."test:one"]
107description = "One buck2 test target, for example: mise run test:one -- //tests:happy_path"
108depends = ["configure"]
109run = "buck2 test"
110
111[tasks."generated:update"]
112description = "Rewrite the committed generated files (Cargo manifests, licence notices) from the buck graph"
113depends = ["configure"]
114run = ["buck2 run //tools/cargo-gen:update", "buck2 run //tools/third-party-notices:update"]
115
116[tasks."gates:record"]
117description = "Record the release gates against the live Jev, spending money (mise run gates:record -- --model jev-1.13.0 --repeats 30); needs TYPESAFE_API_KEY, from the environment or fnox"
118depends = ["configure"]
119run = "tools/with-secrets.sh buck2 run //tools/record-gates:record-gates --"
120
121[tasks."pgrx:install"]
122description = "Build the extension with cargo-pgrx into the Postgres that pg_config names (mise run pgrx:install -- /path/to/pg_config; default: the newest major mise installed)"
123run = '''
124cfg="${1:-$(mise where conda:postgresql@18.6)/bin/pg_config}"
125cargo pgrx install --release --pg-config "$cfg"
126'''