Skip to content

Commit 5611457

Browse files
authored
Merge pull request #519 from openmoq/build-system-cpm
de-bespoke build
2 parents 3ac5043 + 2743ba5 commit 5611457

97 files changed

Lines changed: 2821 additions & 2518 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
.scratch/
21
.git/
32
build/
4-
build-san/
53
_build/
6-
deps/moxygen/.git/
7-
deps/moxygen/moxygen/
8-
deps/moxygen/standalone/
94
install/
5+
.scratch/
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Set up moqx build
2+
description: >
3+
Install system dependencies and restore the ccache + dependency-download
4+
caches shared by every moqx build job. Run right after actions/checkout.
5+
6+
inputs:
7+
ccache-key:
8+
description: >
9+
ccache cache-key namespace — a short slug, distinct per build flavor so
10+
lanes with different flags don't share a cache (e.g. "linux", "asan",
11+
"conformance", "microbench"). Must be a valid actions/cache key fragment:
12+
no commas, so never a human-readable display name.
13+
required: true
14+
15+
runs:
16+
using: composite
17+
steps:
18+
# install-system-deps.sh elevates its own package-manager calls, so the same
19+
# invocation serves both runner families.
20+
- name: Install system dependencies
21+
shell: bash
22+
run: |
23+
scripts/install-system-deps.sh
24+
if [[ "$(uname)" == "Darwin" ]]; then
25+
brew install coreutils
26+
echo "/opt/homebrew/opt/coreutils/libexec/gnubin" >> "$GITHUB_PATH"
27+
fi
28+
29+
# The moqx CMakeLists routes the compiler through ccache automatically when
30+
# it is installed (install-system-deps.sh installs it).
31+
- name: Cache ccache
32+
uses: actions/cache@v5
33+
with:
34+
path: ~/.cache/ccache
35+
key: ccache-${{ runner.os }}-${{ inputs.ccache-key }}-${{ github.sha }}
36+
restore-keys: |
37+
ccache-${{ runner.os }}-${{ inputs.ccache-key }}-
38+
39+
# The prebuilt tarball is named for the host's *distro* release, so the key
40+
# needs that granularity: on runner.os alone a bookworm self-hosted box and
41+
# an ubuntu-22.04 runner collide, and the loser re-downloads every run.
42+
- name: Derive the dependency-cache platform key
43+
id: depkey
44+
shell: bash
45+
run: |
46+
if [[ "$(uname)" == "Darwin" ]]; then
47+
plat="macos-$(sw_vers -productVersion | cut -d. -f1)"
48+
else
49+
plat="$(. /etc/os-release && echo "${ID}-${VERSION_ID}")"
50+
fi
51+
echo "plat=${plat}-$(uname -m)" >> "$GITHUB_OUTPUT"
52+
53+
# One shared fetch cache for CPM sources and the prebuilt moxygen install,
54+
# ~680 MB of downloads per configure otherwise, content-keyed on the pins.
55+
- name: Cache dependency downloads
56+
uses: actions/cache@v5
57+
with:
58+
path: ~/.cache/moqx
59+
key: deps-${{ steps.depkey.outputs.plat }}-${{ hashFiles('cmake/dependencies.cmake') }}
60+
# actions/cache saves only at job end, so a pin bump misses the exact key
61+
# in all ~11 concurrent jobs. The prefix starts them from the previous
62+
# tree and fetches the delta.
63+
restore-keys: |
64+
deps-${{ steps.depkey.outputs.plat }}-
65+
66+
# Restoring by prefix carries every previously pinned rev's install tree
67+
# along (~320 MB each), so drop the unusable ones before the save step
68+
# re-uploads them. The CPM clones accumulate too, but are far smaller.
69+
- name: Prune superseded prebuilt installs
70+
shell: bash
71+
run: |
72+
cache="$HOME/.cache/moqx"
73+
[ -d "$cache" ] || exit 0
74+
rev="$(cmake -DPIN=MOXYGEN_REV -P cmake/print-pin.cmake)"
75+
for d in "$cache"/moxygen-*; do
76+
case "${d##*/}" in
77+
"moxygen-${rev:0:12}-"*) ;; # this run's install
78+
moxygen-????????????-*) rm -rf "$d" ;; # a superseded pin's
79+
esac
80+
done
81+
rm -rf "$cache/downloads"
82+
83+
- name: Route the dependency and ccache dirs through the caches
84+
shell: bash
85+
run: |
86+
# The root only; cmake/DepsCache.cmake puts the CPM clones under it.
87+
echo "MOQX_DEPS_CACHE=$HOME/.cache/moqx" >> "$GITHUB_ENV"
88+
# Pin ccache's dir to the cached path; its own default is platform-dependent.
89+
echo "CCACHE_DIR=$HOME/.cache/ccache" >> "$GITHUB_ENV"
90+
# GITHUB_TOKEN stays off $GITHUB_ENV, which would hand it to every later
91+
# step in the job, ctest among them — and ctest runs the relay and the
92+
# shell integration tests. The configure step sets it for its one API read.

.github/workflows/auto-merge-moxygen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
- name: Generate app token
8080
if: github.event.workflow_run.conclusion == 'success'
8181
id: app-token
82-
uses: actions/create-github-app-token@v2
82+
uses: actions/create-github-app-token@v3
8383
with:
8484
app-id: ${{ secrets.OMOQ_APP_ID }}
8585
private-key: ${{ secrets.OMOQ_APP_PRIV_KEY }}

0 commit comments

Comments
 (0)