-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathaction.yml
More file actions
63 lines (54 loc) · 2.14 KB
/
action.yml
File metadata and controls
63 lines (54 loc) · 2.14 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
name: 'Install PocketIC server'
description: 'Install the PocketIC server at a particular version'
inputs:
pocket-ic-server-version:
description: >
The PocketIC server version to install.
If omitted, the latest version will be installed.
default: '13.0.0'
runs:
using: composite
steps:
- name: Install PocketIC server
shell: bash
run: |
export POCKET_IC_VERSION="${{ inputs.pocket-ic-server-version }}"
echo "POCKET_IC_VERSION is $POCKET_IC_VERSION"
if [ "${{ runner.os }}" = 'Linux' ]; then
export OS="linux"
elif [ "${{ runner.os }}" = 'macOS' ]; then
export OS="darwin"
else
echo "Unsupported OS."
exit 1
fi
if [ "${{ runner.arch }}" = 'X64' ]; then
export ARCH="x86_64"
elif [ "${{ runner.arch }}" = 'ARM64' ]; then
export ARCH="arm64"
else
echo "Unsupported CPU architecture."
exit 1
fi
# if `${POCKET_IC_VERSION}` is a git hash, then use CDN;
# otherwise use a GitHub release.
if [[ "${POCKET_IC_VERSION}" =~ ^[0-9a-f]{40,40}$ ]]; then
URL="https://download.dfinity.systems/ic/${POCKET_IC_VERSION}/binaries/${ARCH}-${OS}/pocket-ic.gz"
else
URL="https://github.com/dfinity/pocketic/releases/download/${POCKET_IC_VERSION}/pocket-ic-${ARCH}-${OS}.gz"
fi
echo "OS is $OS"
echo "ARCH is $ARCH"
echo "URL is $URL"
# Retry up to 10 times. Each attempt has 20 seconds total to complete, 5 seconds of which is to connect.
# This uses the default retry delay, which starts at 1s and doubles each time, up to 10 min.
if $(curl --fail --silent --show-error --location --retry 10 --connect-timeout 5 --max-time 20 --retry-connrefused "${URL}" -o pocket-ic.gz); then
echo "Successfully downloaded PocketIC server."
else
echo "Failed to download PocketIC server."
exit 1
fi
gzip -d pocket-ic.gz
chmod +x pocket-ic
export POCKET_IC_BIN="$(pwd)/pocket-ic"
echo "POCKET_IC_BIN=$POCKET_IC_BIN" >> $GITHUB_ENV