@@ -2,13 +2,17 @@ name: Coroutines build
22
33on :
44 push :
5- branches : [master]
6- pull_request :
5+ branches :
6+ - " **"
7+ workflow_dispatch :
78
89concurrency :
910 group : ${{ github.workflow }}-${{ github.ref }}
1011 cancel-in-progress : true
1112
13+ permissions :
14+ contents : read
15+
1216env :
1317 CARGO_TERM_COLOR : always
1418
1721 name : ${{ matrix.build }} (coroutines)
1822 strategy :
1923 fail-fast : false
24+ max-parallel : 2
2025 matrix :
2126 build : [Linux-x64, Linux-ARM]
2227 include :
2530 - build : Linux-ARM
2631 os : ubuntu-24.04-arm
2732 # The host runner just hosts the container; the actual build happens
28- # inside `ubuntu:25.10 ` (see `container:` below). We pin a specific host
33+ # inside `ubuntu:26.04 ` (see `container:` below). We pin a specific host
2934 # image rather than using `ubuntu-latest` so a GHA runner image rollover
3035 # doesn't silently change anything visible to the build. The container
3136 # image is multi-arch on Docker Hub, so the same `image:` works for
4045 # for the cargo builds. The image still matters for the toolchain, and
4146 # the cache key below encodes it so changing this invalidates the folly
4247 # cache.
43- image : ubuntu:25.10
48+ image : ubuntu:26.04
4449 # Folly's getdeps build can take 30-60+ minutes on a cold cache on
4550 # standard GHA runners (small core count, no parallelism flags). 90
4651 # minutes is a comfortable upper bound. With a warm cache the whole
5863 ca-certificates curl git sudo
5964
6065 - name : Checkout sources
61- uses : actions/checkout@v5
66+ uses : actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
6267 with :
68+ persist-credentials : false
6369 submodules : recursive
6470
6571 - name : Install build dependencies
7278 zlib1g-dev libbz2-dev autoconf automake libtool \
7379 clang llvm
7480
75- # Force gcc-14 instead of ubuntu:25.10 's default gcc-15. folly's pinned
81+ # Force gcc-14 instead of ubuntu:26.04 's default gcc-15. folly's pinned
7682 # libunwind commit (f081cf4...) was written pre-C23 and uses legacy
7783 # K&R-style function declarations (`func()` meaning "unspecified
7884 # arguments"). gcc-15 defaults to `-std=gnu23` for C, where `func()`
@@ -93,42 +99,34 @@ jobs:
9399 g++ --version
94100
95101 - name : Install rust
96- uses : actions-rust-lang/setup-rust-toolchain@v1
102+ uses : actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
97103 with :
104+ toolchain : stable
98105 cache-key : " v1-rust-coroutines"
99- # Populate the cache from master runs only, not from PR runs.
100- cache-save-if : ${{ github.ref == 'refs/heads/master' }}
106+ cache-bin : false
107+ cache-on-failure : false
108+ cache-save-if : ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }}
109+ cache-targets : false
101110
102111 # The folly build's correctness depends on three independent inputs:
103112 # 1. The folly commit (pinned by RocksDB's folly.mk:FOLLY_COMMIT_HASH).
104- # 2. The exact container image (glibc + libstdc++ + apt package versions).
113+ # 2. The container release (glibc + libstdc++ + apt package versions).
105114 # 3. The CPU arch (x86_64 vs aarch64).
106- # All three are encoded in the cache key. The `-v3` suffix lets us bump
115+ # All three are encoded in the cache key. The final suffix lets us bump
107116 # the cache manually if the build script changes in a way that
108- # invalidates prior caches (v2 was the previous ubuntu-24.04-host build).
109- - name : Determine folly commit hash
110- id : folly-hash
111- run : |
112- HASH=$(grep -E '^FOLLY_COMMIT_HASH = ' \
113- librocksdb-sys/rocksdb/folly.mk \
114- | sed -E 's/^FOLLY_COMMIT_HASH = //')
115- echo "hash=$HASH" >> "$GITHUB_OUTPUT"
116-
117- - name : Cache folly install
117+ # invalidates prior caches.
118+ - name : Restore folly install
118119 id : cache-folly
119- uses : actions/cache@v4
120+ uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
120121 with :
121- # `build_folly.sh` uses --scratch-path so install artifacts live
122- # inside the workspace at a predictable location. Cache both that
123- # and the folly source checkout so a warm hit avoids both the
124- # clone and the build. Files written by the build:
125- # librocksdb-sys/folly-build/installed/{folly,boost,...}-*/
126- # librocksdb-sys/folly-build/{downloads,build,extracted,shipit}/
127- # librocksdb-sys/rocksdb/third-party/folly/ (source + patches)
122+ # Cache only the installed artifacts needed by the cargo build. The
123+ # source checkout, downloads, and intermediate object trees are not
124+ # needed on a warm hit and can exceed the repository cache budget.
128125 path : |
129- librocksdb-sys/folly-build
130- librocksdb-sys/rocksdb/third-party/folly
131- key : folly-${{ runner.os }}-${{ runner.arch }}-ubuntu-25.10-${{ steps.folly-hash.outputs.hash }}-v3
126+ librocksdb-sys/folly-build/installed
127+ librocksdb-sys/folly-build/liburing-2.15
128+ librocksdb-sys/folly-build/liburing-prefix.txt
129+ key : folly-${{ runner.arch }}-u26-${{ hashFiles('scripts/build_folly.sh', 'librocksdb-sys/rocksdb/folly.mk', 'librocksdb-sys/rocksdb/build_tools/getdeps_fallback_mirror.py') }}-v1
132130
133131 - name : Build folly
134132 if : steps.cache-folly.outputs.cache-hit != 'true'
@@ -142,13 +140,17 @@ jobs:
142140 # system one here so RocksDB's io_uring code and libfolly.a agree
143141 # on the headers and the runtime library. The file is absent when
144142 # the system liburing was already good enough.
143+ append_env() {
144+ printf '%s\n' "$1" >> "$GITHUB_ENV"
145+ }
146+
145147 LIBURING_PREFIX_FILE="$PWD/librocksdb-sys/folly-build/liburing-prefix.txt"
146148 if [ -f "$LIBURING_PREFIX_FILE" ]; then
147149 LIBURING_PREFIX=$(cat "$LIBURING_PREFIX_FILE")
148150 echo "Using liburing from $LIBURING_PREFIX"
149- echo "PKG_CONFIG_PATH=$LIBURING_PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" >> "$GITHUB_ENV "
150- echo "CPATH=$LIBURING_PREFIX/include${CPATH:+:$CPATH}" >> "$GITHUB_ENV "
151- echo "LIBRARY_PATH=$LIBURING_PREFIX/lib${LIBRARY_PATH:+:$LIBRARY_PATH}" >> "$GITHUB_ENV "
151+ append_env "PKG_CONFIG_PATH=$LIBURING_PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
152+ append_env "CPATH=$LIBURING_PREFIX/include${CPATH:+:$CPATH}"
153+ append_env "LIBRARY_PATH=$LIBURING_PREFIX/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
152154 fi
153155
154156 INSTALL_ROOT="$PWD/librocksdb-sys/folly-build/installed"
@@ -158,7 +160,7 @@ jobs:
158160 ls -la librocksdb-sys/folly-build/ || true
159161 exit 1
160162 fi
161- echo "ROCKSDB_FOLLY_INSTALL_PATH=$INSTALL_ROOT" >> "$GITHUB_ENV "
163+ append_env "ROCKSDB_FOLLY_INSTALL_PATH=$INSTALL_ROOT"
162164
163165 # folly's getdeps produces libglog and libgflags as shared libs only
164166 # (no static archives). librocksdb-sys/build.rs links them dynamically.
@@ -188,9 +190,9 @@ jobs:
188190 if [ -n "${LIBURING_PREFIX:-}" ]; then
189191 RUNTIME_LIBDIRS="$RUNTIME_LIBDIRS:$LIBURING_PREFIX/lib"
190192 fi
191- echo "LD_LIBRARY_PATH=$RUNTIME_LIBDIRS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV "
193+ append_env "LD_LIBRARY_PATH=$RUNTIME_LIBDIRS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
192194
193- - uses : taiki-e/install-action@nextest
195+ - uses : taiki-e/install-action@68250fb3d551d72befef105162372ebb3e8016e0 # nextest
194196
195197 - name : cargo build --features coroutines,io-uring
196198 run : cargo build --release --features coroutines,io-uring
@@ -200,3 +202,16 @@ jobs:
200202
201203 - name : Run doctests with coroutines feature
202204 run : cargo test --doc --release --features coroutines,io-uring
205+
206+ - name : Save folly install
207+ if : >-
208+ steps.cache-folly.outputs.cache-hit != 'true'
209+ && github.event_name == 'push'
210+ && github.ref_name == github.event.repository.default_branch
211+ uses : actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
212+ with :
213+ path : |
214+ librocksdb-sys/folly-build/installed
215+ librocksdb-sys/folly-build/liburing-2.15
216+ librocksdb-sys/folly-build/liburing-prefix.txt
217+ key : folly-${{ runner.arch }}-u26-${{ hashFiles('scripts/build_folly.sh', 'librocksdb-sys/rocksdb/folly.mk', 'librocksdb-sys/rocksdb/build_tools/getdeps_fallback_mirror.py') }}-v1
0 commit comments