4444 # We need jq and GNU coreutils to run show-utils.sh and bash to use inline shell string replacement
4545 # Use sudo-- to get the default sudo package without ambiguity
4646 # Install rust and cargo from OpenBSD packages
47- prepare : pkg_add curl sudo-- jq coreutils bash rust rust-clippy rust-rustfmt llvm--
47+ prepare : |
48+ # Clean up disk space before installing packages
49+ df -h
50+ rm -rf /usr/share/doc/* /usr/share/man/* /var/cache/* /tmp/* || true
51+ pkg_add curl sudo-- jq coreutils bash rust rust-clippy rust-rustfmt llvm--
52+ # Clean up package cache after installation
53+ pkg_delete -a || true
54+ df -h
4855 run : |
4956 ## Prepare, build, and test
5057 # implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783>
@@ -106,8 +113,10 @@ jobs:
106113 # * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
107114 S=\$(cargo clippy --all-targets \${CARGO_UTILITY_LIST_OPTIONS} -- -D warnings 2>&1) && printf "%s\n" "\$S" || { printf "%s\n" "\$S" ; printf "%s" "\$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*\$/::\${FAULT_TYPE} file=\2,line=\3,col=\4::\${FAULT_PREFIX}: \\\`cargo clippy\\\`: \1 (file:'\2', line:\3)/p;" -e '}' ; FAULT=true ; }
108115 fi
109- # Clean to avoid to rsync back the files
116+ # Clean to avoid to rsync back the files and free up disk space
110117 cargo clean
118+ # Additional cleanup to free disk space
119+ rm -rf ~/.cargo/registry/cache ~/.cargo/git/db || true
111120 if [ -n "\${FAIL_ON_FAULT}" ] && [ -n "\${FAULT}" ]; then exit 1 ; fi
112121 EOF
113122
@@ -132,7 +141,14 @@ jobs:
132141 copyback : false
133142 mem : 4096
134143 # Install rust and build dependencies from OpenBSD packages (llvm provides libclang for bindgen)
135- prepare : pkg_add curl gmake sudo-- jq rust llvm--
144+ prepare : |
145+ # Clean up disk space before installing packages
146+ df -h
147+ rm -rf /usr/share/doc/* /usr/share/man/* /var/cache/* /tmp/* || true
148+ pkg_add curl gmake sudo-- jq rust llvm--
149+ # Clean up package cache after installation
150+ pkg_delete -a || true
151+ df -h
136152 run : |
137153 ## Prepare, build, and test
138154 # implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783>
@@ -181,9 +197,13 @@ jobs:
181197 cd "${WORKSPACE}"
182198 unset FAULT
183199 cargo build || FAULT=1
200+ # Clean build artifacts to save disk space before testing
201+ rm -rf target/debug/build target/debug/incremental || true
184202 export PATH=~/.cargo/bin:${PATH}
185203 export RUST_BACKTRACE=1
186204 export CARGO_TERM_COLOR=always
205+ # Avoid filling disk space
206+ export RUSTFLAGS="-C strip=symbols"
187207 # Use cargo test since nextest might not support OpenBSD
188208 if (test -z "\$FAULT"); then cargo test --features '${{ matrix.job.features }}' || FAULT=1 ; fi
189209 # There is no systemd-logind on OpenBSD, so test all features except feat_systemd_logind
@@ -193,7 +213,9 @@ jobs:
193213 fi
194214 # Test building with make
195215 if (test -z "\$FAULT"); then make || FAULT=1 ; fi
196- # Clean to avoid to rsync back the files
216+ # Clean to avoid to rsync back the files and free up disk space
197217 cargo clean
218+ # Additional cleanup to free disk space
219+ rm -rf ~/.cargo/registry/cache ~/.cargo/git/db target/debug/deps target/release/deps || true
198220 if (test -n "\$FAULT"); then exit 1 ; fi
199221 EOF
0 commit comments