This repository was archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHydrunfile
executable file
·139 lines (103 loc) · 3.42 KB
/
Hydrunfile
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
set -e
# Test CLI
if [ "$1" = "test/cli" ]; then
# Install native dependencies
apt update
apt install -y curl make git
# Install Scale
curl -fsSL https://dl.scale.sh?analytics=false | sh
source ~/.bashrc
# Install TinyGo
curl -L -o /tmp/tinygo.tar.gz https://github.com/tinygo-org/tinygo/releases/download/v0.29.0/tinygo0.29.0.linux-amd64.tar.gz
mkdir -p /opt
tar xvzf /tmp/tinygo.tar.gz -C /opt
export PATH=$PATH:/opt/tinygo/bin
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly -y
source ~/.cargo/env
rustup target add wasm32-wasi
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies
make depend/cli depend/signature
# Run tests
make test/cli
exit 0
fi
# Test PWA
if [ "$1" = "test/pwa" ]; then
# Install native dependencies
apt update
apt install -y make git
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies
make depend/pwa
# Run tests
make test/pwa
exit 0
fi
# Build CLI
if [ "$1" = "build/cli" ]; then
# Install native dependencies
apt update
apt install -y curl make git
# Install bagop
curl -L -o /tmp/bagop "https://github.com/pojntfx/bagop/releases/latest/download/bagop.linux-$(uname -m)"
install /tmp/bagop /usr/local/bin
# Install Scale
curl -fsSL https://dl.scale.sh?analytics=false | sh
source ~/.bashrc
# Install TinyGo
curl -L -o /tmp/tinygo.tar.gz https://github.com/tinygo-org/tinygo/releases/download/v0.29.0/tinygo0.29.0.linux-amd64.tar.gz
mkdir -p /opt
tar xvzf /tmp/tinygo.tar.gz -C /opt
export PATH=$PATH:/opt/tinygo/bin
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly -y
source ~/.cargo/env
rustup target add wasm32-wasi
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies
make depend/cli depend/signature
# Build
CGO_ENABLED=0 bagop -j "$(nproc)" -b "$2" -x '(android/*|ios/*|plan9/*|aix/*|linux/loong64|freebsd/riscv64|wasip1/wasm)' -p "make build/cli/$2 DST=\$DST" -d out
exit 0
fi
# Build PWA
if [ "$1" = "build/pwa" ]; then
# Install native dependencies
apt update
apt install -y make git
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies
make depend/pwa
# Build
make build/pwa
exit 0
fi
# Publish signature
if [ "$1" = "publish/signature" ]; then
# Install native dependencies
apt update
apt install -y curl make git
# Install bagop
curl -L -o /tmp/bagop "https://github.com/pojntfx/bagop/releases/latest/download/bagop.linux-$(uname -m)"
install /tmp/bagop /usr/local/bin
# Install Scale
curl -fsSL https://dl.scale.sh?analytics=false | sh
source ~/.bashrc
# Configure Git
git config --global --add safe.directory '*'
# Generate dependencies
make depend/signature
# Sign into Scale
scale --no-telemetry login -f json --api-key "${SCALE_API_KEY}"
# Push signature to Scale registry
scale --no-telemetry registry signature delete "${SCALE_ORG}/classifier:latest" || true # This can fail without issues if the signature does not exist yet
scale --no-telemetry registry signature push local/classifier:latest
exit 0
fi