-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_package.sh
More file actions
executable file
·58 lines (54 loc) · 2.27 KB
/
Copy pathmake_package.sh
File metadata and controls
executable file
·58 lines (54 loc) · 2.27 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
#!/usr/bin/env bash
# =============================================================================
# make_package.sh - build the HELM artifact tarball.
#
# In a git checkout the tarball is `git archive HEAD` (exactly the tracked
# tree, prefixed HELM/): deterministic, and no local venvs, caches, model
# weights, or untracked sweep outputs can leak in. Outside git it falls back
# to tar with an exclude list. This is the tarball uploaded to a GPU box,
# attached by the "Artifact package" CI workflow, and deposited on Zenodo for
# the ACM Artifacts Available badge (see ARTIFACT.md).
#
# Usage: bash make_package.sh
# Output: ../helm_artifact_<date>.tar.gz (override with OUT=/path/file.tar.gz)
# =============================================================================
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DIRNAME="$(basename "$ROOT")"
OUT="${OUT:-$ROOT/../helm_artifact_$(date +%Y%m%d).tar.gz}"
echo "[package] building $OUT"
if git -C "$ROOT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
git -C "$ROOT" archive --format=tar.gz --prefix=HELM/ -o "$OUT" HEAD
if [[ -n "$(git -C "$ROOT" status --porcelain 2>/dev/null)" ]]; then
echo "[package] WARNING: uncommitted or untracked changes present; the tarball reflects HEAD only:"
git -C "$ROOT" status --porcelain | head -20
fi
else
tar -czf "$OUT" -C "$ROOT/.." \
--transform "s,^$DIRNAME/,HELM/," \
--exclude="$DIRNAME/.git" \
--exclude="$DIRNAME/.venv" \
--exclude="$DIRNAME/paper" \
--exclude="$DIRNAME/artifacts" \
--exclude="$DIRNAME/experiments/results" \
--exclude="$DIRNAME/experiments/llama_cpp_src" \
--exclude="$DIRNAME/.mypy_cache" \
--exclude="$DIRNAME/.ruff_cache" \
--exclude="$DIRNAME/.pytest_cache" \
--exclude="$DIRNAME/.repowise" \
--exclude="$DIRNAME/.vscode" \
--exclude="$DIRNAME/helm.egg-info" \
--exclude='*/__pycache__' \
--exclude='*.pyc' \
--exclude='*.gguf' \
--exclude='*.safetensors' \
--exclude='*.bin' \
--exclude='*.tar.gz' \
"$DIRNAME"
fi
echo "[package] done:"
ls -lh "$OUT"
echo "[package] contents (top level):"
tar -tzf "$OUT" | sed 's,^HELM/,,' | awk -F/ 'NF<=2' | sort -u | head -40
echo "[package] sha256:"
sha256sum "$OUT"