-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathaction.yml
More file actions
92 lines (85 loc) · 3.9 KB
/
Copy pathaction.yml
File metadata and controls
92 lines (85 loc) · 3.9 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
name: Set up moqx build
description: >
Install system dependencies and restore the ccache + dependency-download
caches shared by every moqx build job. Run right after actions/checkout.
inputs:
ccache-key:
description: >
ccache cache-key namespace — a short slug, distinct per build flavor so
lanes with different flags don't share a cache (e.g. "linux", "asan",
"conformance", "microbench"). Must be a valid actions/cache key fragment:
no commas, so never a human-readable display name.
required: true
runs:
using: composite
steps:
# install-system-deps.sh elevates its own package-manager calls, so the same
# invocation serves both runner families.
- name: Install system dependencies
shell: bash
run: |
scripts/install-system-deps.sh
if [[ "$(uname)" == "Darwin" ]]; then
brew install coreutils
echo "/opt/homebrew/opt/coreutils/libexec/gnubin" >> "$GITHUB_PATH"
fi
# The moqx CMakeLists routes the compiler through ccache automatically when
# it is installed (install-system-deps.sh installs it).
- name: Cache ccache
uses: actions/cache@v5
with:
path: ~/.cache/ccache
key: ccache-${{ runner.os }}-${{ inputs.ccache-key }}-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ inputs.ccache-key }}-
# The prebuilt tarball is named for the host's *distro* release, so the key
# needs that granularity: on runner.os alone a bookworm self-hosted box and
# an ubuntu-22.04 runner collide, and the loser re-downloads every run.
- name: Derive the dependency-cache platform key
id: depkey
shell: bash
run: |
if [[ "$(uname)" == "Darwin" ]]; then
plat="macos-$(sw_vers -productVersion | cut -d. -f1)"
else
plat="$(. /etc/os-release && echo "${ID}-${VERSION_ID}")"
fi
echo "plat=${plat}-$(uname -m)" >> "$GITHUB_OUTPUT"
# One shared fetch cache for CPM sources and the prebuilt moxygen install,
# ~680 MB of downloads per configure otherwise, content-keyed on the pins.
- name: Cache dependency downloads
uses: actions/cache@v5
with:
path: ~/.cache/moqx
key: deps-${{ steps.depkey.outputs.plat }}-${{ hashFiles('cmake/dependencies.cmake') }}
# actions/cache saves only at job end, so a pin bump misses the exact key
# in all ~11 concurrent jobs. The prefix starts them from the previous
# tree and fetches the delta.
restore-keys: |
deps-${{ steps.depkey.outputs.plat }}-
# Restoring by prefix carries every previously pinned rev's install tree
# along (~320 MB each), so drop the unusable ones before the save step
# re-uploads them. The CPM clones accumulate too, but are far smaller.
- name: Prune superseded prebuilt installs
shell: bash
run: |
cache="$HOME/.cache/moqx"
[ -d "$cache" ] || exit 0
rev="$(cmake -DPIN=MOXYGEN_REV -P cmake/print-pin.cmake)"
for d in "$cache"/moxygen-*; do
case "${d##*/}" in
"moxygen-${rev:0:12}-"*) ;; # this run's install
moxygen-????????????-*) rm -rf "$d" ;; # a superseded pin's
esac
done
rm -rf "$cache/downloads"
- name: Route the dependency and ccache dirs through the caches
shell: bash
run: |
# The root only; cmake/DepsCache.cmake puts the CPM clones under it.
echo "MOQX_DEPS_CACHE=$HOME/.cache/moqx" >> "$GITHUB_ENV"
# Pin ccache's dir to the cached path; its own default is platform-dependent.
echo "CCACHE_DIR=$HOME/.cache/ccache" >> "$GITHUB_ENV"
# GITHUB_TOKEN stays off $GITHUB_ENV, which would hand it to every later
# step in the job, ctest among them — and ctest runs the relay and the
# shell integration tests. The configure step sets it for its one API read.