-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·62 lines (49 loc) · 1.29 KB
/
build.sh
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
#!/usr/bin/env bash
set -e
function check_versions_match {
local versions=()
while read -r l; do
version=$(tomlq -r .package.version "$l")
versions=("${versions[@]}" "$l":"$version")
done < <(find . -mindepth 2 -maxdepth 2 -type f -name Cargo.toml | sort)
manifest=extension/manifest.json
js_version=$(jq -r .version "$manifest")
versions=("${versions[@]}" "$manifest":"$js_version")
version_count=$(echo "${versions[@]}" | xargs -n 1 | cut -d':' -f 2 | sort | uniq | wc -l)
if [ "$version_count" -ne 1 ]; then
echo "Package versions don't match:" >&2
echo >&2
echo "${versions[@]}" | xargs -n 1 >&2
echo >&2
return 1
fi
}
source ./rustflags
if [ "$1" == "check" ]; then
check_versions_match
cargo clean
cargo clippy -- -D warnings
cargo fmt -- --check
cargo check
fi
cargo build --release
pushd extension
./build.sh
xpi_file="$(cat artifact.txt)"
popd
declare TMP_HOME
function cleanup {
if [ -d "$TMP_HOME" ]; then
rm -rf "$TMP_HOME"
fi
}
trap cleanup ERR EXIT
if [ "$1" == "integration" ]; then
pushd integration_tests || exit 1
if [ "$2" == "latest" ]; then
./run_tests.sh -l "$xpi_file"
else
./run_tests.sh "$xpi_file"
fi
popd || exit 1
fi