Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: install script #626

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
ignore:
- ".github/**/*"
- "**/*.sh"
- "**/*.mdx"
- "**/*.pulsar.go"
- "**/*.pb.go"
7 changes: 7 additions & 0 deletions docs/validators/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ This document will guide you through setting up and running Connect, as well as

## Installation

### Using Curl

```bash
curl -sSL https://raw.githubusercontent.com/skip-mev/slinky/main/scripts/install.sh | sudo bash
```

### From GitHub Releases

Head over to our [GitHub Releases](https://github.com/skip-mev/slinky/releases) page and download the binary that matches your machine's architecture.
Expand All @@ -28,6 +34,7 @@ Enter the commands below to install the binary.
```shell
git clone git@github.com:skip-mev/slinky.git
cd slinky
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
make install
```

Expand Down
80 changes: 80 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash

set -e

SLINKY_RELEASES_URL="https://api.github.com/repos/skip-mev/slinky/releases/latest"

# Determine the system architecture
ARCH=$(uname -m)
OS=$(uname -s | tr '[:upper:]' '[:lower:]')

# Fetch the latest release information
echo "Fetching latest release information..."
RELEASE_INFO=$(curl -s ${SLINKY_RELEASES_URL})
VERSION=$(echo ${RELEASE_INFO} | grep -o '"tag_name": "v[^"]*' | cut -d'"' -f4)
VERSION=${VERSION#v} # Remove the 'v' prefix

# Map architecture to release file name
case "${ARCH}" in
x86_64)
if [ "${OS}" = "darwin" ]; then
FILE_NAME="slinky-${VERSION}-darwin-amd64.tar.gz"
else
FILE_NAME="slinky-${VERSION}-linux-amd64.tar.gz"
fi
;;
aarch64|arm64)
if [ "${OS}" = "darwin" ]; then
FILE_NAME="slinky-${VERSION}-darwin-arm64.tar.gz"
else
FILE_NAME="slinky-${VERSION}-linux-arm64.tar.gz"
fi
;;
i386|i686)
FILE_NAME="slinky-${VERSION}-linux-386.tar.gz"
;;
*)
echo "Unsupported architecture: ${ARCH}"
exit 1
;;
esac

# Get download URL for the specific file
DOWNLOAD_URL=$(echo ${RELEASE_INFO} | grep -o "\"browser_download_url\": \"[^\"]*${FILE_NAME}\"" | cut -d'"' -f4)

if [ -z "${DOWNLOAD_URL}" ]; then
echo "Failed to find download URL for ${FILE_NAME}"
exit 1
fi

# Download the release
echo "Downloading ${FILE_NAME}..."
curl -LO "${DOWNLOAD_URL}"

# Create a temporary directory for extraction
TEMP_DIR=$(mktemp -d)
echo "Extracting slinky binary to ${TEMP_DIR}..."
tar -xzf "${FILE_NAME}" -C "${TEMP_DIR}"

# Find the slinky binary
SLINKY_BIN=$(find "${TEMP_DIR}" -type f -name "slinky")

if [ -z "${SLINKY_BIN}" ]; then
echo "Failed to find slinky binary in the extracted files"
rm -rf "${TEMP_DIR}"
rm "${FILE_NAME}"
exit 1
fi

# Move the binary to /usr/local/bin
echo "Installing slinky to /usr/local/bin..."
sudo mv "${SLINKY_BIN}" /usr/local/bin/

# Make it executable
sudo chmod +x /usr/local/bin/slinky

# Clean up
rm -rf "${TEMP_DIR}"
rm "${FILE_NAME}"

echo "Slinky ${VERSION} has been installed successfully!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could have another output that is just like run slinky --help for more info

but not big deal really

4 changes: 2 additions & 2 deletions tests/integration/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
cosmossdk.io/api v0.7.5 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.11.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
cosmossdk.io/depinject v1.0.0 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/log v1.3.1 // indirect
cosmossdk.io/store v1.1.0 // indirect
Expand Down Expand Up @@ -243,7 +243,7 @@ require (
google.golang.org/api v0.176.1 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo=
cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w=
cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc=
cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU=
cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050=
cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8=
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U=
cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI=
Expand Down Expand Up @@ -1678,8 +1678,8 @@ google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUE
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo=
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw=
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
Expand Down
Loading