Skip to content

Commit

Permalink
chore: autonomi rebranding
Browse files Browse the repository at this point in the history
This brings `safeup` in alignment with the rebranding of Safe Network to Autonomi.

BREAKING CHANGE:
* The crate name is changed from `safeup` -> `antup`.
* The binary name is changed from `safeup` -> `antup`.
* The new `ant-releases` repository is referenced and the `sn-releases` reference is removed.
* The settings file has its properties renamed.
  • Loading branch information
jacderida committed Dec 14, 2024
1 parent 04f8474 commit 2d11208
Show file tree
Hide file tree
Showing 8 changed files with 266 additions and 287 deletions.
100 changes: 50 additions & 50 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on: pull_request
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
CLIENT_VERSION: 0.1.2
NODE_VERSION: 0.112.1
NODE_MANAGER_VERSION: 0.11.0
CLIENT_VERSION: 0.3.0-rc.1
NODE_VERSION: 0.3.0-rc.1
ANTCTL_VERSION: 0.11.4-rc.1

jobs:
# The code in this crate uses lots of conditional compilation for cross-platform capabilities.
Expand Down Expand Up @@ -142,29 +142,29 @@ jobs:
run: |
cargo run -- client --version $env:CLIENT_VERSION
cargo run -- node --version $env:NODE_VERSION
cargo run -- node-manager --version $env:NODE_MANAGER_VERSION
cargo run -- antctl --version $env:ANTCTL_VERSION
- name: Check if binaries are available in new shell session
shell: pwsh
run: |
if (!(Test-Path "$env:USERPROFILE\autonomi\autonomi.exe")) {
Write-Host "autonomi.exe does not exist"
if (!(Test-Path "$env:USERPROFILE\autonomi\ant.exe")) {
Write-Host "ant.exe does not exist"
exit 1
}
if (!(Test-Path "$env:USERPROFILE\autonomi\safenode.exe")) {
Write-Host "safenode.exe does not exist"
if (!(Test-Path "$env:USERPROFILE\autonomi\antnode.exe")) {
Write-Host "antnode.exe does not exist"
exit 1
}
if (!(Test-Path "$env:USERPROFILE\autonomi\safenode-manager.exe")) {
Write-Host "safenode-manager.exe does not exist"
if (!(Test-Path "$env:USERPROFILE\autonomi\antctl.exe")) {
Write-Host "antctl.exe does not exist"
exit 1
}
# For security reasons, the GHA infrastructure prevents environment variables
# being modified easily, so we need to refer to the binaries with their full paths.
# Other manual testing has proven that the changes to the Path environment variable do
# take effect.
$output = & "${env:USERPROFILE}\autonomi\autonomi.exe" --version
$version = $output | Select-String -Pattern "autonomi-cli (\d+\.\d+\.\d+(?:-[a-zA-Z0-9]+(?:\.[0-9]+)?)?)"
$output = & "${env:USERPROFILE}\autonomi\ant.exe" --version
$version = $output | Select-String -Pattern "ant-cli (\d+\.\d+\.\d+(?:-[a-zA-Z0-9]+(?:\.[0-9]+)?)?)"
$versionNumber = $version.Matches.Groups[1].Value
if ($versionNumber -eq "$env:CLIENT_VERSION") {
Write-Host "The correct version of autonomi has been installed"
Expand All @@ -175,26 +175,26 @@ jobs:
exit 1
}
$output = & "${env:USERPROFILE}\autonomi\safenode.exe" --version
$output = & "${env:USERPROFILE}\autonomi\antnode.exe" --version
$version = $output -split "`n" | Select-Object -First 1
$versionNumber = ($version -split "v")[1].Trim()
if ($versionNumber -eq "$env:NODE_VERSION") {
Write-Host "The correct version of safenode has been installed"
Write-Host "The correct version of antnode has been installed"
} else {
Write-Host "The correct version of safenode has not been installed"
Write-Host "The correct version of antnode has not been installed"
Write-Host "We expected version $env:NODE_VERSION"
Write-Host "The downloaded binary has $versionNumber"
exit 1
}
$output = & "${env:USERPROFILE}\autonomi\safenode-manager.exe" --version
$output = & "${env:USERPROFILE}\autonomi\antctl.exe" --version
$version = $output -split "`n" | Select-Object -First 1
$versionNumber = ($version -split "v")[1].Trim()
if ($versionNumber -eq "$env:NODE_MANAGER_VERSION") {
Write-Host "The correct version of safenode-manager has been installed"
if ($versionNumber -eq "$env:ANTCTL_VERSION") {
Write-Host "The correct version of antctl has been installed"
} else {
Write-Host "The correct version of safenode-manager has not been installed"
Write-Host "We expected version $env:NODE_MANAGER_VERSION"
Write-Host "The correct version of antctl has not been installed"
Write-Host "We expected version $env:ANTCTL_VERSION"
Write-Host "The downloaded binary has $versionNumber"
exit 1
}
Expand All @@ -215,7 +215,7 @@ jobs:
run: |
cargo run -- client --version $CLIENT_VERSION
cargo run -- node --version $NODE_VERSION
cargo run -- node-manager --version $NODE_MANAGER_VERSION
cargo run -- antctl --version $ANTCTL_VERSION
- name: Check if binaries are available in new shell session
shell: bash
run: |
Expand All @@ -228,36 +228,36 @@ jobs:
# locations.
source ~/.config/autonomi/env
[[ -f "$HOME/.local/bin/autonomi" ]] || { echo "autonomi not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/safenode" ]] || { echo "safenode not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/safenode-manager" ]] || { echo "safenode-manager not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/ant" ]] || { echo "ant not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/antnode" ]] || { echo "antnode not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/antctl" ]] || { echo "antctl not in expected location"; exit 1; }
version=$(autonomi --version | awk '{ print $2 }')
version=$(ant --version | awk '{ print $2 }')
if [[ "$version" == "$CLIENT_VERSION" ]]; then
echo "The correct version of autonomi has been installed"
echo "The correct version of ant has been installed"
else
echo "The correct version of autonomi has not been installed"
echo "The correct version of ant has not been installed"
echo "We expected $CLIENT_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
version=$(safenode --version | head -n 1 | awk '{print $3}' | sed 's/^v//')
version=$(antnode --version | head -n 1 | awk '{print $3}' | sed 's/^v//')
if [[ "$version" == "$NODE_VERSION" ]]; then
echo "The correct version of safenode has been installed"
echo "The correct version of antnode has been installed"
else
echo "The correct version of safenode has not been installed"
echo "The correct version of antnode has not been installed"
echo "We expected $NODE_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
version=$(safenode-manager --version | head -n 1 | awk '{print $4}' | sed 's/^v//')
if [[ "$version" == "$NODE_MANAGER_VERSION" ]]; then
echo "The correct version of safenode-manager has been installed"
version=$(antctl --version | head -n 1 | awk '{print $4}' | sed 's/^v//')
if [[ "$version" == "$ANTCTL_VERSION" ]]; then
echo "The correct version of antctl has been installed"
else
echo "The correct version of safenode-manager has not been installed"
echo "We expected $NODE_MANAGER_VERSION"
echo "The correct version of antctl has not been installed"
echo "We expected $ANTCTL_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
Expand All @@ -277,42 +277,42 @@ jobs:
run: |
cargo run -- client --version $CLIENT_VERSION
cargo run -- node --version $NODE_VERSION
cargo run -- node-manager --version $NODE_MANAGER_VERSION
cargo run -- antctl --version $ANTCTL_VERSION
- name: Check if binaries are available in new shell session
run: |
# As with the Ubuntu test, we need to source the env file to get the binaries on PATH.
source "/Users/runner/Library/Application Support/autonomi/env"
[[ -f "$HOME/.local/bin/autonomi" ]] || { echo "autonomi not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/safenode" ]] || { echo "safenode not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/safenode-manager" ]] || { echo "safenode-manager not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/ant" ]] || { echo "ant not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/antnode" ]] || { echo "antnode not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/antctl" ]] || { echo "antctl not in expected location"; exit 1; }
version=$(autonomi --version | awk '{ print $2 }')
version=$(ant --version | awk '{ print $2 }')
if [[ "$version" == "$CLIENT_VERSION" ]]; then
echo "The correct version of autonomi has been installed"
echo "The correct version of ant has been installed"
else
echo "The correct version of autonomi has not been installed"
echo "The correct version of ant has not been installed"
echo "We expected $CLIENT_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
version=$(safenode --version | head -n 1 | awk '{print $3}' | sed 's/^v//')
version=$(antnode --version | head -n 1 | awk '{print $3}' | sed 's/^v//')
if [[ "$version" == "$NODE_VERSION" ]]; then
echo "The correct version of safenode has been installed"
echo "The correct version of antnode has been installed"
else
echo "The correct version of safenode has not been installed"
echo "The correct version of antnode has not been installed"
echo "We expected $NODE_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
version=$(safenode-manager --version | head -n 1 | awk '{print $4}' | sed 's/^v//')
if [[ "$version" == "$NODE_MANAGER_VERSION" ]]; then
echo "The correct version of safenode-manager has been installed"
version=$(antctl --version | head -n 1 | awk '{print $4}' | sed 's/^v//')
if [[ "$version" == "$ANTCTL_VERSION" ]]; then
echo "The correct version of antctl has been installed"
else
echo "The correct version of safenode-manager has not been installed"
echo "We expected $NODE_MANAGER_VERSION"
echo "The correct version of antctl has not been installed"
echo "We expected $ANTCTL_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[package]
name = "safeup"
name = "antup"
authors = ["MaidSafe Developers <[email protected]>"]
description = "CLI for installing components for accessing the Safe Network"
description = "CLI for installing components for accessing the Autonomi network"
license = "GPL-3.0"
version = "0.8.1"
edition = "2021"

[[bin]]
name = "safeup"
name = "antup"
path = "src/main.rs"

[dependencies]
ant-releases = "0.4.0"
clap = { version = "4.1.6", features = ["derive"] }
chrono = "0.4.26"
color-eyre = "0.6.2"
Expand All @@ -24,7 +25,6 @@ semver = "1.0.4"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
sn-releases = "0.3.1"
tempfile = "3.8.1"
textwrap = "0.16.0"
tokio = { version = "1.26", features = ["full"] }
Expand All @@ -37,4 +37,4 @@ assert_fs = "~1.0"
assert_matches = "1.5.0"
async-trait = "0.1"
mockall = "0.11.3"
predicates = "2.0"
predicates = "2.0"
30 changes: 15 additions & 15 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@ $ErrorActionPreference = "Stop"

Write-Host "**************************************"
Write-Host "* *"
Write-Host "* Installing safeup *"
Write-Host "* Installing antup *"
Write-Host "* *"
Write-Host "**************************************"

$response = Invoke-WebRequest `
-Uri "https://api.github.com/repos/maidsafe/safeup/releases/latest" `
-Uri "https://api.github.com/repos/maidsafe/antup/releases/latest" `
-UseBasicParsing
$json = $response | ConvertFrom-Json
$version = $json.tag_name.TrimStart('v')
Write-Host "Latest version of safeup is $version"
$asset = $json.assets | Where-Object { $_.name -match "safeup-$version-x86_64-pc-windows-msvc.zip" }
Write-Host "Latest version of antup is $version"
$asset = $json.assets | Where-Object { $_.name -match "antup-$version-x86_64-pc-windows-msvc.zip" }
$downloadUrl = $asset.browser_download_url

$archivePath = Join-Path $env:TEMP "safeup.zip"
$archivePath = Join-Path $env:TEMP "antup.zip"
Invoke-WebRequest -Uri $downloadUrl -OutFile $archivePath

$autonomiPath = Join-Path $env:USERPROFILE "autonomi"
New-Item -ItemType Directory -Force -Path $autonomiPath
Expand-Archive -Path $archivePath -DestinationPath $autonomiPath -Force
$antPath = Join-Path $env:USERPROFILE "ant"
New-Item -ItemType Directory -Force -Path $antPath
Expand-Archive -Path $archivePath -DestinationPath $antPath -Force
Remove-Item $archivePath
$safeupExePath = Join-Path $autonomiPath "safeup.exe"
$antExePath = Join-Path $antPath "ant.exe"

$currentPath = [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User)
if ($currentPath -notlike "*$autonomiPath*") {
$newPath = $currentPath + ";" + $autonomiPath
if ($currentPath -notlike "*$antPath*") {
$newPath = $currentPath + ";" + $antPath
[Environment]::SetEnvironmentVariable("PATH", $newPath, [EnvironmentVariableTarget]::User)
Write-Host "Added $autonomiPath to user PATH"
Write-Host "Added $antPath to user PATH"
} else {
Write-Host "Path $autonomiPath is already in user PATH"
Write-Host "Path $antPath is already in user PATH"
}

Write-Host "You may need to start a new session for safeup to become available."
Write-Host "When safeup is available, please run 'safeup --help' to see how to install network components."
Write-Host "You may need to start a new session for antup to become available."
Write-Host "When antup is available, please run 'antup --help' to see how to install network components."
38 changes: 19 additions & 19 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi
function print_banner() {
echo "**************************************"
echo "* *"
echo "* Installing safeup *"
echo "* Installing antup *"
echo "* *"
echo "**************************************"
}
Expand Down Expand Up @@ -73,20 +73,20 @@ function detect_arch() {
armv7*) arch_triple="armv7-unknown-$os-musleabihf" ;;
*) echo "Architecture $arch not supported"; exit 1 ;;
esac
echo "Will retrieve safeup for $arch_triple architecture"
echo "Will retrieve antup for $arch_triple architecture"
}

function get_latest_version() {
release_data=$(curl --silent "https://api.github.com/repos/maidsafe/safeup/releases/latest")
release_data=$(curl --silent "https://api.github.com/repos/maidsafe/antup/releases/latest")
version=$(echo "$release_data" | awk -F': ' '/"tag_name":/ {print $2}' | \
sed 's/"//g' | sed 's/,//g' | sed 's/v//g')
download_url=$(echo "$release_data" | \
awk -F': ' '/"browser_download_url":/ {print $2 $3}' | \
grep "safeup-$version-$arch_triple.tar.gz" | sed 's/"//g' | sed 's/,//g')
echo "Latest version of safeup is $version"
grep "antup-$version-$arch_triple.tar.gz" | sed 's/"//g' | sed 's/,//g')
echo "Latest version of antup is $version"
}

function install_safeup() {
function install_antup() {
if [[ $running_as_root -eq 1 ]]; then
target_dir="/usr/local/bin"
else
Expand All @@ -107,36 +107,36 @@ EOF
fi

temp_dir=$(mktemp -d)
curl -L "$download_url" -o "$temp_dir/safeup.tar.gz"
tar -xzf "$temp_dir/safeup.tar.gz" -C "$temp_dir"
mv "$temp_dir/safeup" "$target_dir/safeup"
chmod +x "$target_dir/safeup"
curl -L "$download_url" -o "$temp_dir/antup.tar.gz"
tar -xzf "$temp_dir/antup.tar.gz" -C "$temp_dir"
mv "$temp_dir/antup" "$target_dir/antup"
chmod +x "$target_dir/antup"
rm -rf "$temp_dir"
echo "safeup installed to $target_dir/safeup"
echo "antup installed to $target_dir/antup"
}

function post_install() {
if [[ $install_client -eq 1 ]]; then
echo "Now running safeup to install the safe client..."
$target_dir/safeup client
echo "Now running antup to install the safe client..."
$target_dir/antup client
fi
if [[ $install_node -eq 1 ]]; then
echo "Now running safeup to install safenode..."
$target_dir/safeup node
echo "Now running antup to install safenode..."
$target_dir/antup node
fi
if [[ $running_as_root -eq 1 ]]; then
echo "Please run 'safeup --help' to see how to install network components."
echo "Please run 'antup --help' to see how to install network components."
else
printf "\n"
echo "The safeup binary has been installed, but it's not available in this session."
echo "The antup binary has been installed, but it's not available in this session."
echo "You must either run 'source ~/.config/autonomi/env' in this session, or start a new session."
echo "When safeup is available, please run 'safeup --help' to see how to install network components."
echo "When antup is available, please run 'antup --help' to see how to install network components."
fi
}

print_banner
detect_os
detect_arch
get_latest_version
install_safeup
install_antup
post_install
Loading

0 comments on commit 2d11208

Please sign in to comment.