Skip to content

Commit bb302d6

Browse files
committed
fix: sort packages and filter out cached ones
1 parent 355783b commit bb302d6

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

.github/workflows/nix-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ jobs:
3030
run: |
3131
set -Eeu
3232
echo matrix="$(python scripts/github-matrix.py extensions)" >> "$GITHUB_OUTPUT"
33-
# XXX debugging
34-
exit 1
3533
3634
build-extensions-aarch64-linux:
3735
name: ${{matrix.postgresql_version}}.${{ matrix.name }} (aarch64-linux)

nix/packages/postgres.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,12 @@
158158
# install.
159159
# - exts: an attrset containing all the extensions, mapped to their
160160
# package names.
161-
makePostgres = version: lib.recurseIntoAttrs {
162-
bin = makePostgresBin version;
163-
exts = makeOurPostgresPkgsSet version;
164-
};
161+
makePostgres =
162+
version:
163+
lib.recurseIntoAttrs {
164+
bin = makePostgresBin version;
165+
exts = makeOurPostgresPkgsSet version;
166+
};
165167
basePackages = {
166168
psql_15 = makePostgres "15";
167169
psql_17 = makePostgres "17";

scripts/github-matrix.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

33
import argparse
4+
from collections import defaultdict
45
import json
56
import os
67
import subprocess
@@ -133,8 +134,7 @@ def run_nix_eval_jobs(
133134

134135
for line in process.stdout:
135136
package = parse_nix_eval_line(line, drv_paths, target)
136-
if package and not package["already_cached"]:
137-
print(f"Found package: {package['attr']}", file=sys.stderr)
137+
if package:
138138
yield package
139139

140140
if process.returncode and process.returncode != 0:
@@ -168,23 +168,22 @@ def main() -> None:
168168

169169
cmd = build_nix_eval_command(max_workers, flake_output)
170170

171-
gh_action_packages = list(run_nix_eval_jobs(cmd, flake_output))
171+
gh_action_packages = sorted(
172+
list(run_nix_eval_jobs(cmd, flake_output)), key=lambda pkg: pkg["name"]
173+
)
172174

173175
if args.target == "extensions":
174176
# filter to only include extension packages and add postgresql_version field
175177
gh_action_packages = [
176178
{**pkg, "postgresql_version": pkg["attr"].split(".")[-3]}
177179
for pkg in gh_action_packages
178-
if is_extension_pkg(pkg)
180+
if is_extension_pkg(pkg) and not pkg["already_cached"]
179181
]
180182

181183
# Group packages by system
182-
grouped_by_system = {}
184+
grouped_by_system = defaultdict(list)
183185
for pkg in gh_action_packages:
184-
system = pkg["system"]
185-
if system not in grouped_by_system:
186-
grouped_by_system[system] = []
187-
grouped_by_system[system].append(pkg)
186+
grouped_by_system[pkg["system"]].append(pkg)
188187

189188
# Create output with system-specific matrices
190189
gh_output = {}

0 commit comments

Comments
 (0)