-
Notifications
You must be signed in to change notification settings - Fork 8
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: add install script #984
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
279d2dd
feat: add install script
xilosada 789ec63
test: replace branch
xilosada 9e84ef7
fix: install meroctl in a local folder
xilosada e067d03
test: restore working branch
xilosada 9ce2dad
test: envar
xilosada d21e187
test: envar 2
xilosada 9273fdf
test: envar 3
xilosada a8c5bc4
fix: prepare for review
xilosada File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Test Install Script | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test-install: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
arch: [x86_64, aarch64] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
# Determine Branch Name | ||
- name: Set Branch Name | ||
id: branch-name | ||
run: | | ||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV | ||
else | ||
echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV | ||
fi | ||
|
||
# Run the installation script | ||
- name: Test installation script | ||
run: | | ||
curl -s https://raw.githubusercontent.com/calimero-network/core/${{ env.BRANCH_NAME }}/scripts/install.sh | bash | ||
|
||
# Validate the binary installation | ||
- name: Validate installation | ||
run: | | ||
which meroctl | ||
meroctl --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
fbozic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
BINARY_NAME="meroctl" | ||
VERSION="v0.1.1" | ||
REPO="calimero-network/core" | ||
INSTALL_DIR="$HOME/.local/bin" | ||
|
||
# Detect OS and Architecture | ||
OS=$(uname | tr '[:upper:]' '[:lower:]') | ||
ARCH=$(uname -m) | ||
|
||
case "$ARCH" in | ||
"x86_64") ARCH="x86_64" ;; | ||
"arm64" | "aarch64") ARCH="aarch64" ;; | ||
*) | ||
echo "Unsupported architecture: $ARCH." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
if [ "$OS" == "darwin" ]; then | ||
PLATFORM="apple-darwin" | ||
elif [ "$OS" == "linux" ]; then | ||
PLATFORM="unknown-linux-gnu" | ||
else | ||
echo "Unsupported operating system: $OS." | ||
exit 1 | ||
fi | ||
|
||
# Construct download URL | ||
TARBALL_NAME="${BINARY_NAME}_${ARCH}-${PLATFORM}.tar.gz" | ||
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION/$TARBALL_NAME" | ||
|
||
# Ensure installation directory exists | ||
mkdir -p "$INSTALL_DIR" | ||
|
||
# Download binary tarball | ||
echo "Downloading $TARBALL_NAME from $DOWNLOAD_URL..." | ||
curl -L -o "$TARBALL_NAME" "$DOWNLOAD_URL" | ||
|
||
# Extract binary | ||
echo "Extracting $TARBALL_NAME..." | ||
tar -xzf "$TARBALL_NAME" | ||
chmod +x "$BINARY_NAME" | ||
|
||
# Move binary to user-local bin directory | ||
mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME" | ||
rm "$TARBALL_NAME" | ||
|
||
# Add $HOME/.local/bin to PATH if not already present | ||
if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then | ||
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc" | ||
echo "Added $HOME/.local/bin to PATH. Reload your shell or run: source ~/.bashrc" | ||
fi | ||
|
||
echo "$BINARY_NAME installed successfully in $INSTALL_DIR. Run '$BINARY_NAME --version' to verify." |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, didn't know that arm instances have landed in the open-source GA. We probably might want to do the same for the build instead of emulating arm builds on amd.