-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathEarthfile
More file actions
111 lines (103 loc) · 5.76 KB
/
Copy pathEarthfile
File metadata and controls
111 lines (103 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
VERSION 0.8
# CI targets, runnable locally: earthly +ci · earthly +build-all
# Works on amd64 and arm64 (TARGETARCH picks the right release binaries).
# trixie: the prelude's buildscript shims need python >= 3.12
# (PurePath.relative_to walk_up); bookworm ships 3.11.
FROM rust:1.94-trixie
WORKDIR /repo
tools:
# Prebuilt buck2 (building it from source takes ~30 min); buck2 ships its
# prelude bundled, so the binary can't drift. reindeer is built from the
# shared_fixups PR branch (facebookincubator/reindeer#107) until it ships in
# a release; pinned by commit for reproducibility. libssl-dev/pkg-config are
# for reindeer's git2 dependency.
ARG TARGETARCH
ARG BUCK2_VERSION=2026-06-01
ARG REINDEER_GIT=https://github.com/gilescope/reindeer
ARG REINDEER_REV=baca1130d34bba20862b71337eac7c024d9be0b0
# nasm: rav1e's asm feature shells out to it for x86_64 SIMD (aarch64 uses a
# different path). GitHub's windows/macOS runners already ship nasm; the
# container didn't, so x86_64 rav1e failed there until now.
RUN apt-get update && apt-get install -y --no-install-recommends \
clang lld cmake protobuf-compiler zstd rsync python3 pkg-config libssl-dev nasm \
&& rm -rf /var/lib/apt/lists/*
RUN case "$TARGETARCH" in \
amd64) TRIPLE=x86_64-unknown-linux-gnu ;; \
arm64) TRIPLE=aarch64-unknown-linux-gnu ;; \
*) echo "unsupported arch: $TARGETARCH" && exit 1 ;; \
esac \
&& curl -fsSL "https://github.com/facebook/buck2/releases/download/${BUCK2_VERSION}/buck2-${TRIPLE}.zst" | zstd -d > /usr/local/bin/buck2 \
&& chmod +x /usr/local/bin/buck2 && buck2 --version
RUN cargo install --locked --git "$REINDEER_GIT" --rev "$REINDEER_REV" reindeer \
&& reindeer --help >/dev/null
src:
FROM +tools
COPY --dir fixups win third-party toolchains ci ./
COPY .buckconfig .buckroot reindeer.toml build-all.sh buckify-all.sh test-cell.sh ./
# `reindeer buckify` must be warning-free AND must not change any committed
# BUCK (main rig + every conflict rig), catching PRs that forgot to buckify.
buckify-check:
FROM +src
RUN ./buckify-all.sh --check
# Regenerate every rig's BUCK and write them back to the host. Used by the
# dependabot-helper workflow to fix bot PRs that bump third-party deps
# without re-running reindeer; also handy locally.
buckify:
FROM +src
RUN ./buckify-all.sh
SAVE ARTIFACT third-party/BUCK AS LOCAL third-party/BUCK
SAVE ARTIFACT third-party/conflict-rigs AS LOCAL third-party/conflict-rigs
# Prove the repo works as a buck2 cell named `fixups` (README contract).
test-cell:
FROM +src
RUN ./test-cell.sh
# Build specific crates by bare name, e.g. the ones whose fixups changed:
# earthly +build-crates --crates="serde ring"
# Builds the crate in every rig that has it (main + conflict + snapshot rigs),
# matching both the bare `:crate` alias (direct deps) and the versioned
# `:crate-<ver>` rust_library (crates that are only transitive in a rig, e.g.
# typenum in the dated snapshots, get no bare alias).
# --rigs additionally builds every alias of the named rig(s), for when a rig
# override targets a crate that's only transitive there:
# earthly +build-crates --crates="quote" --rigs="third-party/conflict-rigs/sqlx"
# Skipped: names with no rig target anywhere (a fixup can exist for a crate no
# rig depends on) and full labels in the platform's expected-failures list
# (known-broken; the sweep tracks those).
build-crates:
FROM +src
ARG crates
ARG rigs
# NB: Earthly RUN executes under /bin/sh, so this stays POSIX (no process
# substitution or bash parameter-expansion tricks).
# The `(-[0-9]…)?` suffix matches transitive `:crate-<ver>` libraries while
# the `-[0-9]` guard stops `:serde` catching `:serde_derive`/`:serde-json`.
# Universe is main rig + conflict rigs only: snapshots are sweep-only (their
# ~1900-crate era mirrors have many standalone-build failures that only the
# matrix sweep catalogs; at PR time buckify-all --check still covers them).
RUN available=$(buck2 uquery "kind('^(alias|rust_library)\$', //third-party: + //third-party/conflict-rigs/...)" | sort -u); \
expected=$(sed '/^#/d;/^$/d' "ci/expected-failures-$(uname -s)-$(uname -m).txt" 2>/dev/null | sort -u || true); \
want=""; \
for c in $crates; do \
hits=$(echo "$available" | grep -E ":${c}(-[0-9][0-9.]*)?\$" || true); \
[ -z "$hits" ] && { echo "skipping $c - no rig target"; continue; }; \
want="$want $hits"; \
done; \
for r in $rigs; do want="$want $(echo "$available" | grep -E "^fixups//${r}:" || true)"; done; \
want=$(echo "$want" | tr ' ' '\n' | sed '/^$/d' | sort -u); \
exp_stems=$(printf '%s\n' "$expected" | sed -E 's/-[0-9][0-9.]*$//' | sort -u); \
if [ -n "$expected" ]; then to_build=$( { printf '%s\n' "$exp_stems" | sed 's/^/E /'; printf '%s\n' "$want" | sed 's/^/W /'; } | awk '$1=="E"{bad[$2]=1;next} {s=$2;sub(/-[0-9][0-9.]*$/,"",s);if(!(s in bad))print $2}'); else to_build="$want"; fi; \
if [ -n "$to_build" ]; then buck2 build $to_build; else echo "nothing to build"; fi
# Sweep crates under --pattern (default: whole tree); failure set must match the
# in-scope entries of ci/expected-failures-<platform>.txt. The sweep CI passes a
# pattern per matrix leg so the big dated-snapshot rigs build in parallel:
# earthly +build-all --pattern="//third-party/snapshots/2025-11/..."
build-all:
FROM +src
ARG pattern="//third-party/..."
# word-split intentional: --pattern may hold several space-separated patterns
# (e.g. main + conflict rigs). /bin/sh splits $pattern into argv for build-all.sh.
# shellcheck disable=SC2086
RUN ./build-all.sh $pattern
ci:
BUILD +buckify-check
BUILD +test-cell