Skip to content

Commit f7e15e2

Browse files
redpanda-fCopilot
andcommitted
feat: curio logs debug level for pdp
feat: workflow testing for pdp-caching-layer being populated feat: devnet-setup is a separate composable action add: matrix for CI, allow testing with and without synapse-sdk remove: synapse-sdk dependency, part of #70 remove: e2e-test-pdp-caching-layers.yml remove: Testing Procedure document fix: include StdErr in logs, go uses it fix: matrix uses notest fix: constants add: fix: CURIO_LOG_LEVEL hoist fix: remove advertised_address so CQL does not fail on DDL Update src/commands/start/curio/db_setup.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 913aa8f commit f7e15e2

7 files changed

Lines changed: 435 additions & 300 deletions

File tree

Lines changed: 347 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,347 @@
1+
---
2+
# Composite action: build foc-devnet, initialise the environment, build Lotus/
3+
# Curio, download proof parameters, and start the devnet cluster.
4+
#
5+
# The calling workflow MUST run actions/checkout@v4 before invoking this action.
6+
7+
name: "Devnet Setup"
8+
description: >
9+
Build foc-devnet, initialise components, and start the devnet cluster.
10+
Supports optional CI caching for Rust, Docker images, and component binaries.
11+
12+
# ─── Inputs ──────────────────────────────────────────────────────────────────
13+
inputs:
14+
curio:
15+
description: "Curio source location override (e.g., 'gitbranch:main')"
16+
required: false
17+
default: ""
18+
lotus:
19+
description: "Lotus source location override (e.g., 'gitbranch:main')"
20+
required: false
21+
default: ""
22+
filecoin-services:
23+
description: "Filecoin Services source location override"
24+
required: false
25+
default: ""
26+
start-flags:
27+
description: "Arguments for 'foc-devnet start' (e.g. '--parallel --notest')"
28+
required: false
29+
default: "--parallel"
30+
enable-caching:
31+
description: "Enable CI caching for Rust, Docker images, and binaries"
32+
required: false
33+
default: "false"
34+
35+
# ─── Outputs ─────────────────────────────────────────────────────────────────
36+
outputs:
37+
start-outcome:
38+
description: "'success' or 'failure'"
39+
value: ${{ steps.start-cluster.outputs.start-outcome }}
40+
41+
# ─── Steps ───────────────────────────────────────────────────────────────────
42+
runs:
43+
using: "composite"
44+
steps:
45+
46+
# Needs cleanup because we have found ourselves running out of disk quite a bit
47+
- name: "EXEC: {Free up disk space}"
48+
uses: endersonmenezes/free-disk-space@v3
49+
with:
50+
remove_android: true
51+
remove_dotnet: true
52+
remove_haskell: true
53+
remove_tool_cache: true
54+
remove_swap: true
55+
remove_packages: >-
56+
azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable
57+
firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*
58+
remove_packages_one_command: true
59+
remove_folders: >-
60+
/usr/share/swift /usr/share/miniconda /usr/share/az*
61+
/usr/local/lib/node_modules /usr/local/share/chromium
62+
/usr/local/share/powershell /usr/local/julia /usr/local/aws-cli
63+
/usr/local/aws-sam-cli /usr/share/gradle
64+
rm_cmd: "rmz"
65+
rmz_version: "3.1.1"
66+
67+
- name: "EXEC: {Setup Rust toolchain}"
68+
uses: actions-rust-lang/setup-rust-toolchain@v1
69+
70+
- name: "CACHE_RESTORE: {Rust build cache}"
71+
if: inputs.enable-caching == 'true'
72+
id: cache-rust
73+
uses: actions/cache/restore@v4
74+
with:
75+
path: |
76+
~/.cargo/registry/index/
77+
~/.cargo/registry/cache/
78+
~/.cargo/git/db/
79+
target/
80+
key: ${{ runner.os }}-rust-build-${{ hashFiles('**/Cargo.lock') }}
81+
restore-keys: |
82+
${{ runner.os }}-rust-build-
83+
84+
- name: "EXEC: {Setup Docker}"
85+
uses: docker/setup-buildx-action@v3
86+
87+
- name: "EXEC: {Install build dependencies}"
88+
shell: bash
89+
run: |
90+
sudo apt-get update
91+
sudo apt-get install -y tar openssl pkg-config libssl-dev
92+
93+
- name: "EXEC: {Build foc-devnet binary}"
94+
shell: bash
95+
run: cargo build --release
96+
97+
- name: "CACHE_SAVE: {Rust build cache}"
98+
if: inputs.enable-caching == 'true' && steps.cache-rust.outputs.cache-hit != 'true'
99+
uses: actions/cache/save@v4
100+
with:
101+
path: |
102+
~/.cargo/registry/index/
103+
~/.cargo/registry/cache/
104+
~/.cargo/git/db/
105+
target/
106+
key: ${{ runner.os }}-rust-build-${{ hashFiles('**/Cargo.lock') }}
107+
108+
- name: "EXEC: {Copy binary and clean Rust artifacts}"
109+
shell: bash
110+
run: |
111+
cp ./target/release/foc-devnet ./foc-devnet
112+
rm -rf ~/.cargo/registry/ ~/.cargo/git/db/ target/
113+
df -h
114+
115+
# Version hashes drive Docker-image and binary cache keys.
116+
- name: "CHECK: {Compute version hashes}"
117+
if: inputs.enable-caching == 'true'
118+
id: version-hashes
119+
shell: bash
120+
run: |
121+
VERSION_OUTPUT=$(./foc-devnet version 2>&1)
122+
CODE_HASH=$(echo "$VERSION_OUTPUT" | grep 'default:code:' | sha256sum | cut -d' ' -f1)
123+
echo "code-hash=$CODE_HASH" >> $GITHUB_OUTPUT
124+
echo "CODE_HASH: $CODE_HASH"
125+
DOCKER_HASH=$(find docker -type f -exec sha256sum {} \; | sort | sha256sum | cut -d' ' -f1)
126+
echo "docker-hash=$DOCKER_HASH" >> $GITHUB_OUTPUT
127+
echo "DOCKER_HASH: $DOCKER_HASH"
128+
129+
# --- Docker image cache ---
130+
- name: "CACHE_RESTORE: {Docker images cache}"
131+
if: inputs.enable-caching == 'true'
132+
id: cache-docker-images
133+
uses: actions/cache/restore@v4
134+
with:
135+
path: ~/.docker-images-cache
136+
key: ${{ runner.os }}-docker-images-${{ steps.version-hashes.outputs.docker-hash }}
137+
138+
- name: "EXEC: {Load Docker images from cache}"
139+
if: inputs.enable-caching == 'true' && steps.cache-docker-images.outputs.cache-hit == 'true'
140+
shell: bash
141+
run: |
142+
echo "Loading Docker images from cache..."
143+
for image in ~/.docker-images-cache/*.tar; do
144+
[ -f "$image" ] && echo "Loading $(basename "$image")..." && docker load -i "$image"
145+
done
146+
echo "Docker images loaded:"
147+
docker images
148+
rm -rf ~/.docker-images-cache
149+
df -h
150+
151+
# --- Init flags from component overrides ---
152+
- name: "CHECK: {Build init flags}"
153+
id: init-flags
154+
shell: bash
155+
run: |
156+
FLAGS=""
157+
[ -n "${{ inputs.curio }}" ] && FLAGS="$FLAGS --curio ${{ inputs.curio }}"
158+
[ -n "${{ inputs.lotus }}" ] && FLAGS="$FLAGS --lotus ${{ inputs.lotus }}"
159+
[ -n "${{ inputs.filecoin-services }}" ] && FLAGS="$FLAGS --filecoin-services ${{ inputs.filecoin-services }}"
160+
echo "flags=$FLAGS" >> $GITHUB_OUTPUT
161+
echo "Init flags: $FLAGS"
162+
163+
# --- Initialise (two mutually-exclusive paths) ---
164+
- name: "EXEC: {Initialise foc-devnet (cached Docker)}"
165+
if: inputs.enable-caching == 'true' && steps.cache-docker-images.outputs.cache-hit == 'true'
166+
shell: bash
167+
run: |
168+
rm -rf ~/.foc-devnet
169+
./foc-devnet init --no-docker-build ${{ steps.init-flags.outputs.flags }}
170+
171+
- name: "EXEC: {Initialise foc-devnet (full)}"
172+
if: inputs.enable-caching != 'true' || steps.cache-docker-images.outputs.cache-hit != 'true'
173+
shell: bash
174+
run: |
175+
rm -rf ~/.foc-devnet
176+
./foc-devnet init ${{ steps.init-flags.outputs.flags }}
177+
178+
# --- Save Docker images for future runs ---
179+
- name: "EXEC: {Save Docker images to cache}"
180+
if: inputs.enable-caching == 'true' && steps.cache-docker-images.outputs.cache-hit != 'true'
181+
shell: bash
182+
run: |
183+
mkdir -p ~/.docker-images-cache
184+
for img in foc-lotus foc-lotus-miner foc-builder foc-curio foc-yugabyte; do
185+
docker save "$img" -o "$HOME/.docker-images-cache/${img}.tar"
186+
done
187+
ls -lath ~/.docker-images-cache/
188+
df -h
189+
190+
- name: "CACHE_SAVE: {Docker images cache}"
191+
if: inputs.enable-caching == 'true' && steps.cache-docker-images.outputs.cache-hit != 'true'
192+
uses: actions/cache/save@v4
193+
with:
194+
path: ~/.docker-images-cache
195+
key: ${{ runner.os }}-docker-images-${{ steps.version-hashes.outputs.docker-hash }}
196+
197+
# --- Component binary cache (Lotus / Curio) ---
198+
- name: "CACHE_RESTORE: {Build artifacts cache}"
199+
if: inputs.enable-caching == 'true'
200+
id: cache-binaries
201+
uses: actions/cache/restore@v4
202+
with:
203+
path: ~/.foc-devnet/bin
204+
key: ${{ runner.os }}-binaries-${{ steps.version-hashes.outputs.code-hash }}
205+
206+
- name: "EXEC: {Ensure permissions on cached binaries}"
207+
if: inputs.enable-caching == 'true' && steps.cache-binaries.outputs.cache-hit == 'true'
208+
shell: bash
209+
run: sudo chown -R "$USER:$USER" ~/.foc-devnet/bin/
210+
211+
# --- Go module cache (only when binaries are not cached) ---
212+
- name: "CACHE_RESTORE: {Go module cache}"
213+
if: inputs.enable-caching == 'true' && steps.cache-binaries.outputs.cache-hit != 'true'
214+
id: cache-go
215+
uses: actions/cache/restore@v4
216+
with:
217+
path: ~/.foc-devnet/docker/volumes/cache/foc-builder
218+
key: ${{ runner.os }}-foc-builder-cache-${{ hashFiles('docker/**') }}-${{ hashFiles('src/config.rs') }}
219+
restore-keys: |
220+
${{ runner.os }}-foc-builder-cache-
221+
222+
- name: "EXEC: {Ensure Go cache permissions}"
223+
if: >-
224+
inputs.enable-caching == 'true'
225+
&& steps.cache-binaries.outputs.cache-hit != 'true'
226+
&& steps.cache-go.outputs.cache-hit == 'true'
227+
shell: bash
228+
run: sudo chown -R "$USER:$USER" ~/.foc-devnet/
229+
230+
- name: "EXEC: {Check disk space}"
231+
shell: bash
232+
run: df -h
233+
234+
# --- Build Lotus & Curio (skip when binary cache hits) ---
235+
- name: "EXEC: {Build Lotus}"
236+
if: inputs.enable-caching != 'true' || steps.cache-binaries.outputs.cache-hit != 'true'
237+
shell: bash
238+
run: ./foc-devnet build lotus
239+
240+
- name: "EXEC: {Build Curio}"
241+
if: inputs.enable-caching != 'true' || steps.cache-binaries.outputs.cache-hit != 'true'
242+
shell: bash
243+
run: ./foc-devnet build curio
244+
245+
# --- Save Go module and binary caches ---
246+
- name: "CACHE_SAVE: {Go module cache}"
247+
if: >-
248+
inputs.enable-caching == 'true'
249+
&& steps.cache-binaries.outputs.cache-hit != 'true'
250+
&& steps.cache-go.outputs.cache-hit != 'true'
251+
uses: actions/cache/save@v4
252+
with:
253+
path: ~/.foc-devnet/docker/volumes/cache/foc-builder
254+
key: ${{ runner.os }}-foc-builder-cache-${{ hashFiles('docker/**') }}-${{ hashFiles('src/config.rs') }}
255+
256+
- name: "CACHE_SAVE: {Build artifacts cache}"
257+
if: inputs.enable-caching == 'true' && steps.cache-binaries.outputs.cache-hit != 'true'
258+
uses: actions/cache/save@v4
259+
with:
260+
path: ~/.foc-devnet/bin
261+
key: ${{ runner.os }}-binaries-${{ steps.version-hashes.outputs.code-hash }}
262+
263+
# --- Clean up build caches to free disk ---
264+
- name: "EXEC: {Clean up build caches}"
265+
shell: bash
266+
run: |
267+
sudo rm -rf ~/.foc-devnet/docker/volumes/cache
268+
sudo rm -rf ~/.foc-devnet/code/lotus
269+
sudo rm -rf ~/.foc-devnet/code/curio
270+
df -h
271+
272+
- name: "EXEC: {Download proof parameters from S3}"
273+
shell: bash
274+
run: |
275+
mkdir -p ~/.foc-devnet/docker/volumes/cache/filecoin-proof-parameters/
276+
curl -L \
277+
https://fil-proof-params-2k-cache.s3.us-east-2.amazonaws.com/filecoin-proof-params-2k.tar \
278+
-o /tmp/filecoin-proof-params-2k.tar
279+
tar -xf /tmp/filecoin-proof-params-2k.tar \
280+
-C ~/.foc-devnet/docker/volumes/cache/filecoin-proof-parameters/
281+
rm /tmp/filecoin-proof-params-2k.tar
282+
ls -lath ~/.foc-devnet/docker/volumes/cache/filecoin-proof-parameters/
283+
284+
- name: "EXEC: {Check cluster status (pre-start)}"
285+
shell: bash
286+
run: ./foc-devnet status
287+
288+
- name: "EXEC: {Configure host.docker.internal}"
289+
shell: bash
290+
run: echo '127.0.0.1 host.docker.internal' | sudo tee -a /etc/hosts
291+
292+
- name: "EXEC: {Start cluster}"
293+
id: start-cluster
294+
shell: bash
295+
run: |
296+
if ./foc-devnet start ${{ inputs.start-flags }}; then
297+
echo "start-outcome=success" >> "$GITHUB_OUTPUT"
298+
else
299+
echo "start-outcome=failure" >> "$GITHUB_OUTPUT"
300+
fi
301+
302+
- name: "EXEC: {Collect debug info}"
303+
if: always()
304+
shell: bash
305+
run: |
306+
RUN_DIR="$HOME/.foc-devnet/state/latest"
307+
308+
echo "+++++++++++ foc-devnet version"
309+
cat "$RUN_DIR/version.txt" 2>/dev/null || echo "No version file found"
310+
311+
echo "+++++++++++ Disk space"
312+
sudo df -h 2>/dev/null || echo "df command failed"
313+
314+
echo "+++++++++++ Run Directory Contents"
315+
ls -lath "$RUN_DIR" 2>/dev/null || echo "No run directory found"
316+
317+
echo "+++++++++++ Contract Addresses"
318+
cat "$RUN_DIR/contract_addresses.json" 2>/dev/null || echo "No contract addresses file found"
319+
320+
echo "+++++++++++ Step Context"
321+
cat "$RUN_DIR/step_context.json" 2>/dev/null || echo "No step context file found"
322+
323+
echo "+++++++++++ FOC Metadata"
324+
cat "$RUN_DIR/foc_metadata.json" 2>/dev/null || echo "No foc metadata file found"
325+
326+
echo "+++++++++++ Container Logs"
327+
if [ -d "$RUN_DIR/logs" ]; then
328+
for logfile in "$RUN_DIR/logs"/*; do
329+
if [ -f "$logfile" ]; then
330+
echo ""
331+
echo "Logs from $(basename "$logfile")"
332+
cat "$logfile" 2>/dev/null || echo "Failed to read $logfile"
333+
fi
334+
done
335+
else
336+
echo "No container logs directory found"
337+
fi
338+
339+
- name: "EXEC: {Check cluster status (post-start)}"
340+
shell: bash
341+
run: ./foc-devnet status
342+
343+
- name: "EXEC: {List containers}"
344+
shell: bash
345+
run: |
346+
echo "Containers using foc-* images (running or exited):"
347+
docker ps -a --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'

0 commit comments

Comments
 (0)