-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (128 loc) · 7.01 KB
/
Copy pathnative-builds.yml
File metadata and controls
147 lines (128 loc) · 7.01 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: native nightly builds (all arches)
# GitHub is zoder's binary build farm. Public repo = unlimited free Actions
# (incl. macOS), and GitHub has native hosted runners for every target zoder
# ships — so all three arches build NATIVELY here (no self-hosted ULTRA, no x86
# cross-compile). Each run:
# 1. publishes the raw trio binaries to the canonical GitLab rolling channel
# (zoder-nightly/{master,DATE}) that install.sh + the fleet puller read;
# 2. packages a per-arch tarball and refreshes the GitHub "nightly" release,
# so the GitHub repo page surfaces fresh, checksummed downloads.
# GitLab keeps the fast per-push gate, the weekly container, and hosts the
# package channel. Runs nightly + on demand only — never per-push.
on:
schedule:
- cron: "15 9 * * *" # 09:15 UTC, just after the GitLab gate window
workflow_dispatch:
concurrency:
group: native-builds
cancel-in-progress: false
permissions:
contents: write # to refresh the "nightly" GitHub release
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
PROJECT_ID: "83731897" # gitlab.com/ncz-os/zoder
ENGINE_REPO: "gitlab.com/ncz-os/zeroclaw.git"
ENGINE_BRANCH: "zoder-integration"
RELEASE_TAG: "nightly"
jobs:
# Reset the rolling "nightly" GitHub release once, before the matrix uploads,
# so stale assets (e.g. an old version's tarballs) never linger.
prepare-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Recreate the nightly release (clear stale assets)
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
DATE="$(date -u +%F)"
NOTES="Rolling nightly trio (zoder + zerocode + zeroclaw), refreshed ${DATE} UTC from master.
- Primary install (all platforms, checksummed): \`curl -fsSL https://raw.githubusercontent.com/ncz-os/zoder/master/install.sh | sh\`
- These tarballs mirror the canonical GitLab channel \`zoder-nightly/master\`.
- Targets: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, aarch64-apple-darwin."
# Delete the release + its tag if present (the prior orphaned release
# had an invalid tag, which blocks `gh release edit`), then create it
# fresh on master. The `nightly` tag + /releases/download/nightly/...
# URLs stay stable, so docs/links don't break.
if gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release delete "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --yes --cleanup-tag || true
fi
git push origin ":refs/tags/${RELEASE_TAG}" 2>/dev/null || true # belt-and-suspenders tag cleanup
gh release create "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --prerelease \
--title "zoder nightly (rolling)" --notes "$NOTES" --target master
build:
name: ${{ matrix.triple }}
needs: prepare-release
strategy:
fail-fast: false
matrix:
include:
- { os: macos-14, triple: aarch64-apple-darwin }
- { os: ubuntu-24.04-arm, triple: aarch64-unknown-linux-gnu }
- { os: ubuntu-latest, triple: x86_64-unknown-linux-gnu }
runs-on: ${{ matrix.os }}
timeout-minutes: 90
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Native build deps (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88
with:
toolchain: "1.94.1"
targets: ${{ matrix.triple }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Build zoder (own repo, --locked)
run: cargo build --release --locked --bin zoder --target ${{ matrix.triple }}
- name: Build engine trio, publish to GitLab channel + GitHub release
env:
TRIPLE: ${{ matrix.triple }}
ENGINE_USER: ${{ secrets.GITLAB_ENGINE_USER }}
ENGINE_TOKEN: ${{ secrets.GITLAB_ENGINE_TOKEN }}
PKG_TOKEN: ${{ secrets.GITLAB_PACKAGE_TOKEN }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
sha256() { if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi; }
# Clone the engine fork at zoder-integration HEAD (private → deploy token).
rm -rf .zc-src
git clone --depth 1 --branch "$ENGINE_BRANCH" \
"https://${ENGINE_USER}:${ENGINE_TOKEN}@${ENGINE_REPO}" .zc-src
ZC_SHA="$(git -C .zc-src rev-parse HEAD)"
echo "engine $ENGINE_BRANCH HEAD = $ZC_SHA"
# Build the engine pair natively. Prefer --locked (fork lock kept in
# sync); fall back to unlocked on drift so the nightly still ships.
if ! ( cd .zc-src && cargo build --release --locked -p zeroclawlabs -p zerocode --bin zeroclaw --bin zerocode --target "$TRIPLE" ); then
echo "::warning::--locked engine build failed (fork Cargo.lock drift?); rebuilding unlocked"
( cd .zc-src && cargo build --release -p zeroclawlabs -p zerocode --bin zeroclaw --bin zerocode --target "$TRIPLE" )
fi
ZBIN="target/${TRIPLE}/release/zoder"
CBIN=".zc-src/target/${TRIPLE}/release/zerocode"
EBIN=".zc-src/target/${TRIPLE}/release/zeroclaw"
for f in "$ZBIN" "$CBIN" "$EBIN"; do [ -f "$f" ] || { echo "missing built binary: $f" >&2; exit 1; }; done
# 1) raw binaries → canonical GitLab rolling channel (install.sh reads this)
DATE="$(date -u +%F)"
BASE="https://gitlab.com/api/v4/projects/${PROJECT_ID}/packages/generic/zoder-nightly"
publish_raw() { # $1 = name, $2 = src
local dst="$1-${TRIPLE}" shaf; shaf="$(mktemp)"; sha256 "$2" > "$shaf"
local ch
for ch in master "$DATE"; do
curl --fail --silent --show-error --header "DEPLOY-TOKEN: ${PKG_TOKEN}" --upload-file "$2" "${BASE}/${ch}/${dst}"
curl --fail --silent --show-error --header "DEPLOY-TOKEN: ${PKG_TOKEN}" --upload-file "$shaf" "${BASE}/${ch}/${dst}.sha256"
done
}
publish_raw zoder "$ZBIN"
publish_raw zerocode "$CBIN"
publish_raw zeroclaw "$EBIN"
# 2) per-arch tarball → GitHub "nightly" release (repo-page discoverability)
STAGE="zoder-${TRIPLE}"
rm -rf "$STAGE" && mkdir -p "$STAGE"
cp "$ZBIN" "$CBIN" "$EBIN" "$STAGE/"
TAR="${STAGE}.tar.gz"
tar -czf "$TAR" "$STAGE"
# "<hash> <file>" format so users can `sha256sum -c` / `shasum -a 256 -c`.
echo "$(sha256 "$TAR") ${TAR}" > "${TAR}.sha256"
gh release upload "$RELEASE_TAG" "$TAR" "${TAR}.sha256" --repo "$GITHUB_REPOSITORY" --clobber
echo "published $TRIPLE (engine $ZC_SHA) to GitLab channel + GitHub $RELEASE_TAG release" >> "$GITHUB_STEP_SUMMARY"