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
·125 lines (108 loc) · 3.26 KB
/
bootstrap.sh
File metadata and controls
executable file
·125 lines (108 loc) · 3.26 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
120
121
122
123
124
125
#!/bin/bash
source $(git rev-parse --show-toplevel)/ci3/source_bootstrap
cmd=${1:-}
export TRANSPILER=$PWD/../avm-transpiler/target/release/avm-transpiler
export BB=$PWD/../barretenberg/cpp/build/bin/bb
export NARGO=$PWD/../noir/noir-repo/target/release/nargo
export AZTEC_NARGO=$PWD/../aztec-nargo/compile_then_postprocess.sh
export AZTEC_BUILDER=$PWD/../yarn-project/builder/aztec-builder-dest
hash=$(cache_content_hash \
.rebuild_patterns \
../noir/.rebuild_patterns \
../{avm-transpiler,noir-projects,l1-contracts,yarn-project}/.rebuild_patterns \
../barretenberg/*/.rebuild_patterns)
function build {
echo_header "boxes build"
denoise yarn
if ! cache_download boxes-$hash.tar.gz; then
denoise 'yarn build'
cache_upload boxes-$hash.tar.gz boxes/*/{artifacts,dist,src/contracts/target}
fi
}
function test {
echo_header "boxes test"
test_cmds | filter_test_cmds | parallelise
}
function test_cmds {
for browser in chromium webkit firefox; do
for box in vanilla react vite; do
echo "$hash boxes/scripts/run_test.sh $box $browser"
done
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/l1-contracts.git"
cd boxes/vanilla
rm -rf release-out && mkdir release-out
git archive HEAD | tar -x -C release-out
cd release-out
$root/ci3/npm/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
"clean")
git clean -fdx
;;
"ci")
build
test
;;
""|"fast"|"full")
build
;;
test|test_cmds|release)
$cmd
;;
"hash")
echo $hash
;;
*)
echo "Unknown command: $cmd"
exit 1
esac