-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2032 from radixdlt/main
Merge main into develop
- Loading branch information
Showing
6 changed files
with
495 additions
and
62 deletions.
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 |
---|---|---|
@@ -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" | ||
|
@@ -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 the below places (including the toolchain below) in this repo: | ||
# => [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 | ||
|
@@ -17,14 +17,23 @@ 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 | ||
# Additionally, Rust version should be updated in below repos on respective branches: | ||
# - babylon-node - .github/actions/setup-env/action.yml | ||
# - fuzzer - .github/actions/setup-env/action.yml | ||
toolchain: 1.81.0 | ||
default: true | ||
target: wasm32-unknown-unknown | ||
components: rustfmt | ||
|
||
- name: Install nextest | ||
uses: RDXWorks-actions/install-action@nextest | ||
uses: RDXWorks-actions/install-action@main | ||
with: | ||
tool: [email protected] | ||
|
||
- name: Set LIBCLANG_PATH # See https://github.com/rust-lang/rust-bindgen/issues/1797 | ||
if: runner.os == 'Windows' | ||
|
@@ -38,7 +47,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 | ||
|
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 |
---|---|---|
@@ -1,62 +1,46 @@ | ||
## Summary | ||
``` | ||
INSTRUCTIONS: | ||
Add summary - one or two sentences explaining the purpose of this PR. | ||
``` | ||
> [!IMPORTANT] | ||
> | ||
> * Please read our [Contributing Guidelines](/CONTRIBUTING.md) before opening a PR. | ||
> * Before creating your PR, please ensure you read the [node branching strategy](https://github.com/radixdlt/babylon-node/blob/main/docs/branching-strategy.md), which is also used in this repository. The end result after completing the merge actions should be that `main <= release/XXX <= develop`, where `XXX` is the latest released protocol version. This ensures that we minimise merge conflicts, and that work doesn't go missing. | ||
> * As per the branching strategy, **you must ensure you select the _correct base branch_**, both for branching from, and in the PR UI above. The following process can be used to decide the base branch: | ||
> * For code changes which can wait until the next protocol update to be released, use `develop`. This should be the default for code changes. | ||
> * For code changes which need to go out as a fully-interoperable update to the node at the current protocol version, use `release/XXX`. | ||
> * Such changes must be tested and reviewed more carefully to mitigate the risk of regression. | ||
> * Once the change is merged, it is the merger's responsibility to ensure `release/XXX` is merged into the `develop` branch. | ||
> * For github workflow changes, use `main`. | ||
> * Once the change is merged, it is the merger's responsibility to ensure `main` is merged into both `release/XXX` and `develop`, so that the changes also apply to hotfixes, and to current development. | ||
> * For changes to README files, use `main`. | ||
> * Once the change is merged, it is the merger's responsibility to ensure `main` is merged into both `release/XXX` and `develop`, so that the changes also apply on these branches. | ||
> | ||
> _Please remove this section once you confirm you follow its guidance._ | ||
## Details | ||
``` | ||
INSTRUCTIONS: | ||
Provide further details about the changes, or how they fit into the roadmap. | ||
You can delete this section if it's not useful. | ||
``` | ||
## Summary | ||
<!-- | ||
> [!TIP] | ||
> | ||
> Start with the context of your PR. Why are you making this change? What does it address? Link back to an issue if relevant. | ||
> | ||
> Then summarise the changes that were made. Bullet points are fine. Feel free to add additional subheadings (using ###) with more information if required. | ||
--> | ||
|
||
## Testing | ||
``` | ||
INSTRUCTIONS: | ||
Further details about the tests you've added or manually performed. | ||
You can delete this section if it's not useful. | ||
``` | ||
<!-- | ||
> [!TIP] | ||
> | ||
> Explain what testing / verification is done, including manual testing or automated testing. | ||
--> | ||
|
||
## Update Recommendations | ||
``` | ||
INSTRUCTIONS: | ||
This section is to provide recommendations to consumers of this repo about how they | ||
should handle breaking changes, or integrate new features. The two key stakeholder | ||
groups are dApp Developers and Internal Integrators, and there are separate sections | ||
for each. | ||
In order to allow us to compile aggregated update instructions across PRs, please tag the PR | ||
with 0+ of the relevant labels: | ||
* scrypto-lib - Any change to the scrypto library | ||
* sbor - Any breaking change to SBOR encoding/decoding | ||
* manifest - Any change to manifest display, compilation/decompilation | ||
* transaction - Any change which affects the compiled manifest, or transaction semantics | ||
* substate - Any change to substates, the state model, or what's stored in the DB | ||
* native-blueprint-interface - Any change to the interface of native blueprints | ||
* files-moved - Any change to where engine types have moved, which will require | ||
internal integrators to update their imports | ||
If you have a breaking change which doesn't fix into a category above, then tag it with | ||
the closest label, and discuss in slack/discord. | ||
If your PR contains no breaking changes or new features or hasn't been tagged, this whole | ||
section can be deleted. | ||
``` | ||
|
||
### For dApp Developers | ||
``` | ||
INSTRUCTIONS: | ||
Migration recommendations for a dApp developer to update their dApp/integrations | ||
due to to the change/s in this PR. | ||
These will be aggregated by the Developer Ecosystem team and included in the next Scrypto migration guide | ||
(eg https://docs-babylon.radixdlt.com/main/scrypto/release_notes/migrating_from_0.7_to_0.8.html ) | ||
``` | ||
|
||
### For Internal Integrators | ||
``` | ||
INSTRUCTIONS: | ||
Instructions to any internal integrations (eg Node, Toolkit, Gateway, Ledger App) for how the changes may affect | ||
them and recommendations for how they should update to support this change. | ||
``` | ||
<!-- | ||
> [!NOTE] | ||
> | ||
> This section is to provide recommendations to consumers of this repo about how they should handle breaking changes, or integrate new features. | ||
> | ||
> If your PR contains no breaking changes or new features or hasn't been tagged, this whole section can be deleted. Add sub-headings if required for: | ||
> * ### Guidance for dApp Developers | ||
> * Migration recommendations for a dApp developer to update their dApp/integrations due to to the change/s in this PR. This should include renames and interface changes. | ||
> * Upon merge, please copy these instructions to an appropriate draft page under https://docs.radixdlt.com/main/scrypto/release_notes | ||
> * ### Guidance for Internal Integrators | ||
> * Instructions to any internal integrations (e.g. Node, Toolkit, Gateway, Ledger App) for how the changes may affect them and recommendations for how they should update to support this change. | ||
> | ||
--> |
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
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,214 @@ | ||
#!/bin/bash | ||
|
||
# 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' | ||
BLUE='\033[0;34m' | ||
YELLOW='\033[1;33m' | ||
NC='\033[0m' # No Color | ||
|
||
# Function to log messages with colors | ||
log() { | ||
local level=$1 | ||
shift | ||
case $level in | ||
"INFO") echo -e "${BLUE}[INFO]${NC} $*" ;; | ||
"SUCCESS") echo -e "${GREEN}[SUCCESS]${NC} $*" ;; | ||
"ERROR") echo -e "${RED}[ERROR]${NC} $*" ;; | ||
"WARN") echo -e "${YELLOW}[WARN]${NC} $*" ;; | ||
esac | ||
} | ||
|
||
# Function to check if command exists | ||
command_exists() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
# Function to check system dependencies | ||
check_dependencies() { | ||
log "INFO" "Checking system dependencies..." | ||
|
||
# Check if we're on a Debian-based system | ||
if ! command_exists apt-get; then | ||
log "ERROR" "This script requires apt-get (Debian/Ubuntu). For other distributions, please modify the script accordingly." | ||
exit 1 | ||
fi | ||
|
||
# Check if sudo is available | ||
if ! command_exists sudo; then | ||
log "ERROR" "This script requires sudo privileges." | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Function to install build essentials | ||
install_build_essentials() { | ||
log "INFO" "Installing build essentials..." | ||
|
||
# Update package list | ||
sudo apt-get update | ||
|
||
# Install build essentials | ||
sudo apt-get install -y build-essential | ||
|
||
if [ $? -eq 0 ]; then | ||
log "SUCCESS" "Build essentials installed successfully" | ||
else | ||
log "ERROR" "Failed to install build essentials" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Function to install LLVM | ||
install_llvm() { | ||
log "INFO" "Installing LLVM..." | ||
|
||
# Download and install LLVM | ||
wget https://apt.llvm.org/llvm.sh | ||
chmod +x llvm.sh | ||
sudo ./llvm.sh $LLVM_VERSION | ||
rm llvm.sh | ||
|
||
if [ $? -eq 0 ]; then | ||
log "SUCCESS" "LLVM installed successfully" | ||
else | ||
log "ERROR" "Failed to install LLVM" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Function to install Rust | ||
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=$RUST_VERSION -y | ||
|
||
if [ $? -eq 0 ]; then | ||
log "SUCCESS" "Rust installed successfully" | ||
else | ||
log "ERROR" "Failed to install Rust" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Function to setup Cargo environment | ||
setup_cargo() { | ||
log "INFO" "Setting up Cargo environment..." | ||
|
||
# Source cargo environment | ||
source "$HOME/.cargo/env" | ||
|
||
if command_exists cargo; then | ||
log "SUCCESS" "Cargo environment setup successfully" | ||
else | ||
log "ERROR" "Failed to setup Cargo environment" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Function to add WebAssembly target | ||
add_wasm_target() { | ||
log "INFO" "Adding WebAssembly target..." | ||
|
||
rustup target add wasm32-unknown-unknown | ||
|
||
if [ $? -eq 0 ]; then | ||
log "SUCCESS" "WebAssembly target added successfully" | ||
else | ||
log "ERROR" "Failed to add WebAssembly target" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Function to install Radix tools | ||
install_radix_tools() { | ||
log "INFO" "Installing Radix Engine Simulator and CLI tools..." | ||
|
||
cargo install --force radix-clis@$RADIX_CLI_VERSION | ||
|
||
if [ $? -eq 0 ]; then | ||
log "SUCCESS" "Radix tools installed successfully" | ||
else | ||
log "ERROR" "Failed to install Radix tools" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Function to add Clang to shell configuration | ||
add_clang_to_shell_config() { | ||
# Determine the user's shell | ||
SHELL_NAME=$(basename "$SHELL") | ||
|
||
# Determine the shell configuration file based on the default shell | ||
case "$SHELL_NAME" in | ||
bash) SHELL_CONFIG="$HOME/.bashrc" ;; | ||
zsh) SHELL_CONFIG="$HOME/.zshrc" ;; | ||
ksh) SHELL_CONFIG="$HOME/.kshrc" ;; | ||
fish) SHELL_CONFIG="$HOME/.config/fish/config.fish" ;; | ||
*) | ||
log "ERROR" "Unsupported shell. Please add 'export CC=clang-${LLVM_VERSION}' to your shell configuration manually." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# The line to add | ||
EXPORT_LINE="export CC=clang-${LLVM_VERSION}" | ||
|
||
# Check if the line already exists to prevent duplicates | ||
if grep -Fxq "$EXPORT_LINE" "$SHELL_CONFIG" | ||
then | ||
log "INFO" "The CC variable is already set in $SHELL_CONFIG" | ||
else | ||
# Backup the shell configuration file | ||
cp "$SHELL_CONFIG" "${SHELL_CONFIG}.backup" | ||
|
||
# Append the export line to the shell configuration file | ||
echo "$EXPORT_LINE" >> "$SHELL_CONFIG" | ||
log "INFO" "Added '$EXPORT_LINE' to $SHELL_CONFIG" | ||
fi | ||
} | ||
|
||
# Main installation process | ||
main() { | ||
log "INFO" "Starting installation process..." | ||
|
||
# Check system dependencies | ||
check_dependencies | ||
|
||
# Install components | ||
install_build_essentials | ||
install_llvm | ||
install_rust | ||
setup_cargo | ||
add_wasm_target | ||
install_radix_tools | ||
add_clang_to_shell_config | ||
|
||
# Final success message | ||
log "SUCCESS" "Installation completed successfully!" | ||
source $HOME/.cargo/env | ||
|
||
# Verify installations | ||
log "INFO" "Verifying installations..." | ||
echo -e "\nVersions installed:" | ||
echo -e "LLVM: $(llvm-config-${LLVM_VERSION} --version)" | ||
echo -e "Clang: $(clang-${LLVM_VERSION} --version | head -n 1)" | ||
echo -e "Rust: $(rustc --version)" | ||
echo -e "Cargo: $(cargo --version)" | ||
echo -e "Radix CLI: $(scrypto --version)\n" | ||
|
||
log "INFO" "Please restart your terminal or run:" | ||
echo "source $SHELL_CONFIG" | ||
} | ||
|
||
# Run main function | ||
main |
Oops, something went wrong.