-
Notifications
You must be signed in to change notification settings - Fork 77
110 lines (88 loc) · 2.88 KB
/
build.yml
File metadata and controls
110 lines (88 loc) · 2.88 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
name: Compile and Test
on:
push:
branches:
- 'main'
- 'release/**'
pull_request:
branches:
- '**'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
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
container:
image: ghcr.io/curvineio/curvine-compile:latest
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-targets: false
- name: Run fmt
run: |
echo "Running fmt check (fastest, no compilation needed)"
cargo fmt --check
echo "After fmt, disk usage:"
df -h
- 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 2 -- --${CLIPPY_LEVEL}=warnings --allow clippy::uninlined-format-args
echo "After clippy, disk usage:"
df -h
- name: Clean after clippy
run: |
# Clean clippy artifacts to save space
find target -name "*.rlib" -delete || true
find target -name "*.rmeta" -delete || true
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
# Build with limited parallelism to save memory
cargo build --verbose --jobs 2
echo "After build, disk usage:"
df -h
- 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