Skip to content

Commit b6eb344

Browse files
committed
Submodule SHA-driven artifact fetch, rename ci.yml, fix Dockerfile
- Rename ci.yml → verify.yml (file matches workflow name) - Rewrite setup-deps-tarball.sh to use Actions API: finds the publish workflow run matching the exact submodule commit SHA, downloads artifacts from that run. Falls back to snapshot-latest release if no run found. - Both verify.yml and publish.yml now generate an app token (omoq-sync-bot) for cross-repo Actions API access to moxygen. - Dockerfile: ubuntu:22.04 base with all runtime deps needed by the current dynamically-linked binary (stopgap until moxygen PR #58 lands static linking). - Advance deps/moxygen submodule to df1d2f5 (includes sync #59).
1 parent 8f38447 commit b6eb344

5 files changed

Lines changed: 62 additions & 24 deletions

File tree

.github/workflows/publish.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,23 @@ jobs:
2727
runs-on: ${{ matrix.runner }}
2828

2929
steps:
30+
- name: Generate app token
31+
id: app-token
32+
uses: actions/create-github-app-token@v2
33+
with:
34+
app-id: ${{ secrets.OMOQ_APP_ID }}
35+
private-key: ${{ secrets.OMOQ_APP_PRIV_KEY }}
36+
3037
- uses: actions/checkout@v4
3138
with:
3239
submodules: true
3340

3441
- name: Install system dependencies
3542
run: bash deps/moxygen/standalone/install-system-deps.sh
3643

37-
- name: Download moxygen release tarball
44+
- name: Download moxygen artifacts
3845
env:
39-
GH_TOKEN: ${{ github.token }}
46+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
4047
run: bash scripts/setup-deps-tarball.sh
4148

4249
- name: Set up ccache
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,23 @@ jobs:
3131
name: ${{ matrix.name }}
3232
runs-on: ${{ matrix.runner }}
3333
steps:
34+
- name: Generate app token
35+
id: app-token
36+
uses: actions/create-github-app-token@v2
37+
with:
38+
app-id: ${{ secrets.OMOQ_APP_ID }}
39+
private-key: ${{ secrets.OMOQ_APP_PRIV_KEY }}
40+
3441
- uses: actions/checkout@v4
3542
with:
3643
submodules: true
3744

3845
- name: Install system dependencies
3946
run: bash deps/moxygen/standalone/install-system-deps.sh
4047

41-
- name: Download moxygen release tarball
48+
- name: Download moxygen artifacts
4249
env:
43-
GH_TOKEN: ${{ github.token }}
50+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
4451
run: bash scripts/setup-deps-tarball.sh
4552

4653
- name: Configure

docker/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
FROM debian:bookworm-slim
2-
RUN apt-get update && apt-get install -y --no-install-recommends libssl3 && rm -rf /var/lib/apt/lists/*
1+
FROM ubuntu:22.04
2+
RUN apt-get update && apt-get install -y --no-install-recommends \
3+
libboost-context1.74.0 \
4+
libdouble-conversion3 \
5+
libevent-2.1-7 \
6+
libfmt8 \
7+
libgflags2.2 \
8+
libgoogle-glog0v5 \
9+
libsodium23 \
10+
libssl3 \
11+
libunwind8 \
12+
libzstd1 \
13+
&& rm -rf /var/lib/apt/lists/*
314
COPY install/bin/o_rly /usr/local/bin/o-rly
415
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
516
RUN chmod +x /usr/local/bin/entrypoint.sh

scripts/setup-deps-tarball.sh

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/usr/bin/env bash
22
# setup-deps-tarball.sh — Populate .scratch with prebuilt moxygen release artifacts.
33
#
4-
# Downloads the snapshot-latest release tarball from openmoq/moxygen.
4+
# Uses the submodule commit SHA to find the exact publish workflow run
5+
# on openmoq/moxygen, then downloads the matching platform artifact.
56
# Writes .scratch/cmake_prefix_path.txt for configure.sh.
67
#
78
# Usage:
89
# ./scripts/setup-deps-tarball.sh
910
#
10-
# Requires: gh CLI authenticated, deps/moxygen submodule initialized.
11+
# Requires: gh CLI authenticated (with actions:read on openmoq/moxygen),
12+
# deps/moxygen submodule initialized.
1113

1214
set -euo pipefail
1315

@@ -61,29 +63,40 @@ detect_platform() {
6163
PLATFORM=$(detect_platform)
6264
echo "==> Platform: $PLATFORM"
6365

64-
# ── Download from snapshot-latest ─────────────────────────────────────────────
66+
# ── Find publish run matching submodule SHA ───────────────────────────────────
6567

6668
SHA=$(git -C "$MOXYGEN_DIR" rev-parse HEAD)
67-
TAG="snapshot-latest"
6869
echo "==> Moxygen submodule SHA: ${SHA:0:7}"
69-
echo "==> Downloading from release: $TAG"
70-
71-
if ! gh api "repos/openmoq/moxygen/releases/tags/$TAG" --jq '.tag_name' >/dev/null 2>&1; then
72-
echo "Error: release $TAG not found in openmoq/moxygen." >&2
73-
echo " The publish workflow may not have run yet." >&2
74-
exit 1
75-
fi
7670

7771
TARBALL="moxygen-${PLATFORM}.tar.gz"
7872
DOWNLOAD_DIR="${SCRATCH}/downloads"
7973
mkdir -p "$DOWNLOAD_DIR"
8074

81-
echo "==> Downloading $TARBALL..."
82-
rm -f "${DOWNLOAD_DIR}/${TARBALL}"
83-
gh release download "$TAG" \
84-
--repo openmoq/moxygen \
85-
--pattern "$TARBALL" \
86-
--dir "$DOWNLOAD_DIR"
75+
echo "==> Searching for publish run at ${SHA:0:7}..."
76+
RUN_ID=$(gh api "repos/openmoq/moxygen/actions/workflows/omoq-publish-artifacts.yml/runs?head_sha=${SHA}&status=success&per_page=1" \
77+
--jq '.workflow_runs[0].id // empty')
78+
79+
if [[ -n "$RUN_ID" ]]; then
80+
echo "==> Found publish run $RUN_ID, downloading $TARBALL..."
81+
rm -f "${DOWNLOAD_DIR}/${TARBALL}"
82+
gh run download "$RUN_ID" \
83+
--repo openmoq/moxygen \
84+
--name "$TARBALL" \
85+
--dir "$DOWNLOAD_DIR"
86+
else
87+
echo "==> No publish run for ${SHA:0:7}, trying snapshot-latest release..."
88+
if ! gh api "repos/openmoq/moxygen/releases/tags/snapshot-latest" --jq '.tag_name' >/dev/null 2>&1; then
89+
echo "Error: no artifacts found for SHA ${SHA:0:7} and no snapshot-latest release." >&2
90+
echo " The publish workflow may not have run yet for this commit." >&2
91+
exit 1
92+
fi
93+
rm -f "${DOWNLOAD_DIR}/${TARBALL}"
94+
gh release download "snapshot-latest" \
95+
--repo openmoq/moxygen \
96+
--pattern "$TARBALL" \
97+
--dir "$DOWNLOAD_DIR"
98+
echo " Warning: using snapshot-latest (may not match submodule SHA)"
99+
fi
87100

88101
# ── Extract ───────────────────────────────────────────────────────────────────
89102

0 commit comments

Comments
 (0)