-
Notifications
You must be signed in to change notification settings - Fork 101
145 lines (120 loc) · 4.66 KB
/
Copy pathbuild.yml
File metadata and controls
145 lines (120 loc) · 4.66 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Compile and Smoke Test
on:
push:
branches:
- 'main'
- 'release/**'
pull_request:
branches:
- '**'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
# Tune build parallelism: 4 uses more CPU on standard 4-vCPU runner; set to 2 if OOM
CARGO_BUILD_JOBS: 4
jobs:
# Speed note: slowness is from runner CPU/RAM (standard = 4 vCPU, ~16GB), not container size.
# Containers share the runner; you cannot set CPU/memory in workflow. Options: use larger
# runners (org enables "larger runners", then runs-on: labels: ubuntu-24.04-8core etc.), or
# self-hosted runners with more cores.
cleanup:
runs-on: ubuntu-latest
steps:
- name: Clean hostedtoolcache to free disk space on host
run: |
echo "Disk usage before cleanup:"
df -h
# Remove GitHub Actions pre-installed toolchain cache on host machine
sudo rm -rf /opt/hostedtoolcache || true
echo "Disk usage after cleanup:"
df -h
build:
runs-on: ubuntu-latest
needs: cleanup
# curvine-tests image extends curvine-compile:rocky9 and pre-installs Flask, werkzeug, pip, jq, fio (see curvine-tests/Dockerfile)
container:
image: ghcr.io/curvineio/curvine-tests:rocky9
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: |
export PATH="/root/.cargo/bin:$PATH"
unset RUSTUP_UPDATE_ROOT
unset RUSTUP_DIST_SERVER
rustup default stable
rustc --version
cargo --version
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "curvine-build"
cache-all-crates: false
# Cache target/ so release build and smoke tests can reuse artifacts (much faster on cache hit)
cache-targets: true
- name: Run fmt
run: |
echo "Running fmt check (fastest, no compilation needed)"
cargo fmt --check
echo "After fmt, disk usage:"
df -h
- name: Dependency boundary guardrails
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
make check-client-deps
- name: API crate dependency boundary check
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
make check-api-crate-deps
- name: Run clippy
env:
CLIPPY_LEVEL: deny
run: |
echo "Running clippy (static code analysis)"
# Run clippy in debug mode to match build
cargo clippy --all-targets --jobs ${{ env.CARGO_BUILD_JOBS }} -- --${CLIPPY_LEVEL}=warnings --allow clippy::uninlined-format-args
echo "After clippy, disk usage:"
df -h
- name: Clean after clippy
run: |
# Free disk by removing only clippy's incremental data; keep .rlib/.rmeta so
# Rust Cache (cache-targets) can reuse them for the release build
rm -rf target/debug/incremental || true
echo "After clippy cleanup, disk usage:"
df -h
- name: Build
run: |
echo "Starting final build, disk usage:"
df -h
cargo build --verbose --jobs ${{ env.CARGO_BUILD_JOBS }}
echo "After build, disk usage:"
df -h
- name: Minimal client artifact dependency guardrails
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
make check-minimal-artifact-deps
# - name: Run unit tests (skip UFS-dependent tests in CI)
# env:
# NEXTEST_CI_NO_UFS: "1"
# run: |
# export PATH="/root/.cargo/bin:$PATH"
# cd "$GITHUB_WORKSPACE"
# python3 curvine-tests/regression/build-server.py \
# -p "$GITHUB_WORKSPACE" \
# -r "$GITHUB_WORKSPACE/test_results" \
# --nextest-profile ci-no-ufs \
# --run-once \
# --unit-only \
# --summary-to-markdown "$GITHUB_STEP_SUMMARY"
# On failure, summary is written to GitHub Step Summary; step exits non-zero so pipeline fails.
- name: Final cleanup before cache save
run: |
echo "Final cleanup before cache save"
# Clean all temporary files
rm -rf target/release/incremental || true
rm -rf target/release/.fingerprint || true
find target -name "*.d" -delete || true
# Clean cargo cache
rm -rf ~/.cargo/registry/cache || true
rm -rf ~/.cargo/.package-cache || true
echo "Final disk usage:"
df -h