Skip to content

Commit b2fc2ca

Browse files
committed
chore(ci): guard local artifacts and trim placeholders
- add scripts/check_local_artifacts.sh and run it early in CI jobs - add scripts/clean.sh for local cleanup of generated artifacts - remove unused asset placeholder .gitkeep files Tests: cargo test && cargo build
1 parent 5c4f9d2 commit b2fc2ca

8 files changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v4
1515

16+
- name: Guard local artifacts
17+
run: ./scripts/check_local_artifacts.sh
18+
1619
- name: Setup Rust
1720
uses: dtolnay/rust-toolchain@stable
1821
with:
@@ -43,6 +46,9 @@ jobs:
4346
- name: Checkout
4447
uses: actions/checkout@v4
4548

49+
- name: Guard local artifacts
50+
run: ./scripts/check_local_artifacts.sh
51+
4652
- name: Install Linux native build deps
4753
run: |
4854
sudo apt-get update

assets/critters/.gitkeep

Whitespace-only changes.

assets/fonts/.gitkeep

Whitespace-only changes.

assets/layers/.gitkeep

Whitespace-only changes.

assets/particles/.gitkeep

Whitespace-only changes.

assets/plants/.gitkeep

Whitespace-only changes.

scripts/check_local_artifacts.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "$repo_root"
6+
7+
mapfile -t tracked_files < <(git ls-files)
8+
offenders=()
9+
10+
for path in "${tracked_files[@]}"; do
11+
case "$path" in
12+
*.DS_Store|target/*|.codex_audit/*)
13+
offenders+=("$path")
14+
;;
15+
esac
16+
done
17+
18+
if [ "${#offenders[@]}" -gt 0 ]; then
19+
echo "Local artifact guard failed."
20+
echo "Remove these tracked files before committing:"
21+
printf ' - %s\n' "${offenders[@]}"
22+
exit 1
23+
fi
24+
25+
echo "Local artifact guard passed."

scripts/clean.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "$repo_root"
6+
7+
bytes_before="$(du -sk . 2>/dev/null | awk '{print $1}')"
8+
9+
cleaned_any=0
10+
11+
# Remove macOS finder metadata files that can appear in project trees.
12+
while IFS= read -r ds_store; do
13+
if find "$ds_store" -maxdepth 1 -name '.DS_Store' -print -quit | grep -q .; then
14+
find "$ds_store" -maxdepth 1 -name '.DS_Store' -delete
15+
cleaned_any=1
16+
fi
17+
done < <(printf '%s\n' "$repo_root" "$(dirname "$repo_root")")
18+
19+
# Remove generated Rust build output.
20+
if [ -d "target" ]; then
21+
find target -depth -mindepth 1 -delete
22+
rmdir target 2>/dev/null || true
23+
cleaned_any=1
24+
fi
25+
26+
# Remove local Codex audit scratch artifacts if present.
27+
if [ -d ".codex_audit" ]; then
28+
find .codex_audit -depth -mindepth 1 -delete
29+
rmdir .codex_audit 2>/dev/null || true
30+
cleaned_any=1
31+
fi
32+
33+
bytes_after="$(du -sk . 2>/dev/null | awk '{print $1}')"
34+
freed_kb=$((bytes_before - bytes_after))
35+
if [ "$freed_kb" -lt 0 ]; then
36+
freed_kb=0
37+
fi
38+
39+
if [ "$cleaned_any" -eq 1 ]; then
40+
echo "Cleanup complete. Freed approximately ${freed_kb} KB."
41+
else
42+
echo "Nothing to clean."
43+
fi

0 commit comments

Comments
 (0)