Skip to content

Commit

Permalink
tweak: parametrise install scripts tool versions
Browse files Browse the repository at this point in the history
  • Loading branch information
azizi-a committed Nov 22, 2024
1 parent 6447731 commit 5aba962
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
12 changes: 8 additions & 4 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Setup environment'
description: 'Common GH action to setup job environment'
name: "Setup environment"
description: "Common GH action to setup job environment"

runs:
using: "composite"
Expand All @@ -8,7 +8,7 @@ runs:
uses: RDXWorks-actions/toolchain@master
with:
# IMPORTANT:
# To update the Rust version, you must update it in five total places (including the toolchain below):
# To update the Rust version, you must update it in eight total places (including the toolchain below):
# => [README.md - part 1] Update "Install Rust - we recommend to use Rust X.XX.X"
# => [README.md - part 2] Update "rustup default X.XX.X"
# => [action.yml - part 1] Update "toolchain: X.XX.X" below
Expand All @@ -17,6 +17,10 @@ runs:
# different version is used.
# => [Dockerfile] Update "FROM rust:X.XX.X-slim-bookworm AS base-image" in the deterministic builder
# => [radix-clis/assets/template/rust-toolchain.toml_template] Update the rust version
# => [scrypto-install-scripts/*] Update the all version in each scripts "# Versions to install" section. Keep the current version number format:
# => [scrypto-install-scripts/install-scrypto-debian.sh] "LLVM_VERSION=XX", "RUST_VERSION=X.XX.X", "RADIX_CLI_VERSION=X.X.X"
# => [scrypto-install-scripts/install-scrypto-macos.sh] "LLVM_VERSION=XX", "RUST_VERSION=X.XX.X", "RADIX_CLI_VERSION=X.X.X"
# => [scrypto-install-scripts/install-scrypto-windows.ps1] "$llvmVersion = 'XX.X.X'", "$rustVersion = 'X.XX.X'", "$radixCliVersion = 'X.X.X'"
# => [https://docs.radixdlt.com/docs/getting-rust-scrypto] Update the recommended rust version on docs
toolchain: 1.81.0
default: true
Expand All @@ -38,7 +42,7 @@ runs:
if: runner.os == 'Linux'
uses: RDXWorks-actions/actions-setup-cmake@master
with:
cmake-version: '3.27.9'
cmake-version: "3.27.9"
- name: Install libclang-dev
if: runner.os == 'Linux'
run: sudo apt-get -y update && sudo apt-get install clang libclang-dev -y -f
Expand Down
11 changes: 8 additions & 3 deletions scrypto-install-scripts/install-scrypto-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Exit on error
set -e

# Versions to install
LLVM_VERSION=18
RUST_VERSION=1.81.0
RADIX_CLI_VERSION=1.3.0

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
Expand Down Expand Up @@ -52,7 +57,7 @@ install_llvm() {
sudo apt-get update

# Install build essentials and LLVM
sudo apt-get install -y clang build-essential llvm
sudo apt-get install -y clang build-essential llvm-$LLVM_VERSION

if [ $? -eq 0 ]; then
log "SUCCESS" "LLVM and build essentials installed successfully"
Expand All @@ -67,7 +72,7 @@ install_rust() {
log "INFO" "Installing Rust..."

# Download and install Rust with specific toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=1.81.0 -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=$RUST_VERSION -y

if [ $? -eq 0 ]; then
log "SUCCESS" "Rust installed successfully"
Expand Down Expand Up @@ -110,7 +115,7 @@ add_wasm_target() {
install_radix_tools() {
log "INFO" "Installing Radix Engine Simulator and CLI tools..."

cargo install --force radix-clis@1.3.0
cargo install --force radix-clis@$RADIX_CLI_VERSION

if [ $? -eq 0 ]; then
log "SUCCESS" "Radix tools installed successfully"
Expand Down
15 changes: 10 additions & 5 deletions scrypto-install-scripts/install-scrypto-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Print commands and exit on errors
set -ex

# Versions to install
LLVM_VERSION=18
RUST_VERSION=1.81.0
RADIX_CLI_VERSION=1.3.0

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
Expand All @@ -28,7 +33,7 @@ check_status "Xcode Command Line Tools installation"

# Install cmake and LLVM
echo -e "\n${BLUE}Installing cmake and LLVM...${NC}"
brew install cmake llvm@17
brew install cmake llvm@$LLVM_VERSION
check_status "cmake and LLVM installation"

# Detect shell and configure appropriate rc file
Expand All @@ -44,14 +49,14 @@ fi

# Add LLVM to PATH
echo -e "\n${BLUE}Configuring LLVM in $SHELL_CONFIG...${NC}"
if ! grep -q "$(brew --prefix llvm@18)/bin" "$SHELL_CONFIG"; then
echo 'PATH="$(brew --prefix llvm@18)/bin:$PATH"' >> "$SHELL_CONFIG"
if ! grep -q "$(brew --prefix llvm@${LLVM_VERSION})/bin" "$SHELL_CONFIG"; then
echo 'PATH="$(brew --prefix llvm@'$LLVM_VERSION')/bin:$PATH"' >> "$SHELL_CONFIG"
fi
check_status "LLVM path configuration"

# Install Rust
echo -e "\n${BLUE}Installing Rust...${NC}"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=1.81.0 -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=$RUST_VERSION -y
check_status "Rust installation"

# Source cargo environment
Expand All @@ -66,7 +71,7 @@ check_status "WebAssembly target installation"

# Install Radix Engine Simulator and CLI tools
echo -e "\n${BLUE}Installing Radix Engine Simulator and CLI tools...${NC}"
cargo install --force radix-clis@1.3.0
cargo install --force radix-clis@$RADIX_CLI_VERSION
check_status "Radix tools installation"

echo -e "\n${GREEN}Installation complete! Please restart your terminal or run:${NC}"
Expand Down
13 changes: 8 additions & 5 deletions scrypto-install-scripts/install-scrypto-windows.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Requires PowerShell running as Administrator
#Requires -RunAsAdministrator

# Versions to install
$llvmVersion = '18.1.8'
$rustVersion = '1.81.0'
$radixCliVersion = '1.3.0'

# Script configuration
$ErrorActionPreference = "Stop"
$ProgressPreference = "Continue"
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'Continue'

# Colors for output
function Write-ColorOutput($ForegroundColor) {
Expand Down Expand Up @@ -85,7 +90,6 @@ if (!(Test-Path $vsInstallerPath)) {
}

# 3. Install LLVM
$llvmVersion = "18.1.8"
Install-IfNotPresent "LLVM" "clang" {
Write-ColorOutput Cyan "Downloading LLVM..."

Expand All @@ -104,7 +108,6 @@ Install-IfNotPresent "LLVM" "clang" {
}

# 4. Install Rust
$rustVersion = "1.81.0"
Install-IfNotPresent "Rust" "rustc" {
Write-ColorOutput Cyan "Downloading and installing Rust..."
$rustupInit = "$env:TEMP\rustup-init.exe"
Expand All @@ -123,7 +126,7 @@ rustup target add wasm32-unknown-unknown

# 7. Install Radix Engine Simulator and CLI tools
Write-ColorOutput Cyan "Installing Radix Engine Simulator and CLI tools..."
cargo install --force radix-clis@1.3.0
cargo install --force radix-clis@$radixCliVersion
Refresh-EnvironmentVariables

# Final success message
Expand Down

0 comments on commit 5aba962

Please sign in to comment.