forked from AztecProtocol/aztec-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·119 lines (101 loc) · 3.16 KB
/
bootstrap.sh
File metadata and controls
executable file
·119 lines (101 loc) · 3.16 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
#!/usr/bin/env bash
source $(git rev-parse --show-toplevel)/ci3/source_bootstrap
export AZTEC=$(realpath ../yarn-project/aztec/scripts/aztec.sh)
export BB=$(realpath ../barretenberg/cpp/build/bin/bb)
export NARGO=$(realpath ../noir/noir-repo/target/release/nargo)
hash=$(hash_str \
$(../noir/bootstrap.sh hash) \
$(cache_content_hash \
.rebuild_patterns \
../{avm-transpiler,noir-projects,l1-contracts,yarn-project}/.rebuild_patterns \
../barretenberg/*/.rebuild_patterns))
function build_box {
cd boxes/$1
yarn build
}
function test_box {
CPUS=4 docker_isolate "./scripts/run_test.sh ${1:-vanilla} ${2:-chromium}"
}
function build {
echo_header "boxes build"
npm_install_deps
if ! cache_download boxes-$hash.tar.gz; then
denoise 'yarn build'
cache_upload boxes-$hash.tar.gz boxes/*/{artifacts,dist,src/contracts/target,contracts/target}
fi
}
function test {
echo_header "boxes test"
test_cmds | filter_test_cmds | parallelize
}
function test_cmds {
for box in react vite vanilla; do
echo "$hash:ISOLATE=1:NET=1:CPUS=4 ./boxes/scripts/run_test.sh $box chromium"
done
}
# First argument is a branch name (e.g. master, or the latest version e.g. 1.2.3) to push to the head of.
# Second argument is the tag name (e.g. v1.2.3, or commit-<hash>).
# Third argument is the semver for package.json (e.g. 1.2.3 or 1.2.3-commit.<hash>)
#
# v1.2.3 commit-123cafebabe
# | /
# v1.2.2 commit-123deadbeef
# | /
# v1.2.1
#
function release_git_push {
local branch_name=$1
local tag_name=$2
local version=$3
local mirrored_repo_url="https://github.com/AztecProtocol/aztec-starter-vanilla.git"
cd boxes/vanilla
rm -rf release-out && mkdir release-out
git archive HEAD | tar -x -C release-out
cd release-out
release_prep_package_json $version
# CI needs to authenticate from GITHUB_TOKEN.
gh auth setup-git &>/dev/null || true
git init &>/dev/null
git remote add origin "$mirrored_repo_url" &>/dev/null
git fetch origin --quiet
# Checkout the existing branch or create it if it doesn't exist.
if git ls-remote --heads origin "$branch_name" | grep -q "$branch_name"; then
# Update branch reference without checkout.
git branch -f "$branch_name" origin/"$branch_name"
# Point HEAD to the branch.
git symbolic-ref HEAD refs/heads/"$branch_name"
# Move to latest commit, keep working tree.
git reset --soft origin/"$branch_name"
else
git checkout -b "$branch_name"
fi
if git rev-parse "$tag_name" >/dev/null 2>&1; then
echo "Tag $tag_name already exists. Skipping release."
else
git add .
git commit -m "Release $tag_name." >/dev/null
git tag -a "$tag_name" -m "Release $tag_name."
do_or_dryrun git push origin "$branch_name" --quiet
do_or_dryrun git push origin --quiet --force "$tag_name" --tags
echo "Release complete ($tag_name) on branch $branch_name."
fi
}
function release {
echo_header "boxes release"
local branch=$(dist_tag)
if [ $branch = latest ]; then
branch=master
fi
release_git_push $branch $REF_NAME ${REF_NAME#v}
}
case "$cmd" in
"")
build
;;
"hash")
echo $hash
;;
*)
default_cmd_handler "$@"
;;
esac