-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·97 lines (83 loc) · 4.09 KB
/
Copy pathrun-tests.sh
File metadata and controls
executable file
·97 lines (83 loc) · 4.09 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
#!/usr/bin/env bash
set -eEuo pipefail
readonly POCKETIC_VERSION="13.0.0"
readonly POCKETIC_URL="https://github.com/dfinity/pocketic/releases/download/${POCKETIC_VERSION}/pocket-ic-x86_64-linux.gz"
readonly POCKETIC_CHECKSUM="80ea3190c497c6486ac9e73303bacb6361f2a42e04c8dc4449caa39b03488764"
readonly ASSET_WASM_URL="https://github.com/dfinity/sdk/raw/fec030f53814e7eaa2f869189e8852b5c0e60e5e/src/distributed/assetstorage.wasm.gz"
readonly ASSET_WASM_CHECKSUM="865eb25df5a6d857147e078bb33c727797957247f7af2635846d65c5397b36a6"
readonly LARGE_ASSETS_WASM_URL="https://github.com/dfinity/ic-http-gateway-protocol/raw/42408f658199d7278d8ff3293504a06e1b0ef61d/examples/http-gateway/canister/http_gateway_canister_custom_assets.wasm.gz"
readonly LARGE_ASSETS_WASM_CHECKSUM="eedcbf986c67fd4ebe3042094604a9a5703e825e56433e2509a6a4d0384ccf95"
readonly WORKDIR="$(pwd)"
readonly CANISTER_DIR="${WORKDIR}/canister_wasms"
readonly POCKETIC_BIN="${WORKDIR}/pocket-ic"
readonly CARGO_TARGET_DIR="${WORKDIR}/target/debug"
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >&2; }
log "Downloading PocketIC v${POCKETIC_VERSION}"
curl -fsSL --retry 3 --retry-delay 5 --retry-all-errors "${POCKETIC_URL}" -o pocket-ic.gz || {
log "Failed to download PocketIC"
exit 1
}
echo "${POCKETIC_CHECKSUM} pocket-ic.gz" | sha256sum -c - || {
log "PocketIC checksum verification failed"
exit 1
}
log "Extracting PocketIC"
gzip -df pocket-ic.gz || { log "Failed to extract PocketIC"; exit 1; }
chmod +x "${POCKETIC_BIN}" || { log "Failed to make PocketIC executable"; exit 1; }
export POCKET_IC_BIN="${POCKETIC_BIN}"
log "PocketIC setup completed"
# Get a list of latest IC master hashes that passed "Kickoff".
# One of them should have ic-boundary binary published.
readonly IC_COMMITS=$(gh run list --repo dfinity/ic --branch master --workflow "Kickoff" --json headSha,conclusion --jq '.[] | select(.conclusion == "success") | .headSha')
log "Downloading ic-boundary"
OK=0
for COMMIT in ${IC_COMMITS}
do
log "Trying commit ${COMMIT}"
URL="https://download.dfinity.systems/ic/${COMMIT}/binaries/x86_64-linux/ic-boundary.gz"
if curl -fsSL --retry 3 --retry-delay 5 --retry-all-errors -o ic-boundary.gz ${URL}; then
OK=1
break
fi
done
if [ $OK -ne 1 ]; then
log "Couldn't download ic-boundary from any of the commits"
exit 1
fi
rm -f ic-boundary
gzip -d ic-boundary.gz
chmod +x ic-boundary
log "Building ic-gateway"
cargo build --features debug || { log "ic-gateway build failed"; exit 1; }
export CARGO_TARGET_DIR
log "ic-gateway build completed"
log "Downloading asset canister WASM"
mkdir -p "${CANISTER_DIR}" || { log "Failed to create canister directory"; exit 1; }
curl -fsSL --retry 3 --retry-delay 5 --retry-all-errors "${ASSET_WASM_URL}" -o "${CANISTER_DIR}/assetstorage.wasm.gz" || {
log "Failed to download asset canister WASM"
exit 1
}
echo "${ASSET_WASM_CHECKSUM} ${CANISTER_DIR}/assetstorage.wasm.gz" | sha256sum -c - || {
log "Asset canister WASM checksum verification failed"
exit 1
}
log "Asset canister WASM downloaded"
log "Downloading large assets canister WASM"
mkdir -p "${CANISTER_DIR}" || { log "Failed to create canister directory"; exit 1; }
curl -fsSL --retry 3 --retry-delay 5 --retry-all-errors "${LARGE_ASSETS_WASM_URL}" -o "${CANISTER_DIR}/largeassets.wasm.gz" || {
log "Failed to download large assets canister WASM"
exit 1
}
echo "${LARGE_ASSETS_WASM_CHECKSUM} ${CANISTER_DIR}/largeassets.wasm.gz" | sha256sum -c - || {
log "Asset canister WASM checksum verification failed"
exit 1
}
log "Asset canister WASM downloaded"
export ASSET_CANISTER_DIR="${CANISTER_DIR}"
log "Running unit tests using all feature combinations"
cargo all-features test --all-features --profile dev --workspace -- --nocapture --skip all_intergration_tests || { log "Unit tests failed"; exit 1; }
log "Unit tests completed successfully"
log "Running integration tests with all features enabled"
cargo test --all-features --profile dev --workspace -- --nocapture --test all_intergration_tests || { log "Integration tests failed"; exit 1; }
log "Integration tests completed successfully"
rm -rf ic-boundary denylist_seed.json pocket-ic canister_wasms