forked from lambdaclass/cairo-vm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve dependency installation experience (lambdaclass#1298)
* Add installation instructions to README * Add compilation step to installation testing * Add script for universal dependency installation * Update changelog * Enable test_install workflow only on main * Update optional dependencies Just having PyEnv and make installed suffices for running `make deps`. I don't think we need to list cairo-lang as a dependency. * Don't compile, only check * Push again * Use swatinem cache * Cache all crates even on failure * Fix debian rust cache * Use manual cache * Test cache * Cache cairo compiler * Add pyenv dependency caching * Cache pip instead of pyenv * Try fixing cache * Use setup-python action * Use ~ instead of ${HOME} * Use manual cache in Debian container * Add some comments * Make cache owned by current user and add logs * Remove python install from script
- Loading branch information
1 parent
a48ee62
commit bdc338d
Showing
8 changed files
with
169 additions
and
63 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
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
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
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
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,82 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Print an error message and exit with 1 | ||
unsupported_os () { | ||
echo "Detected OS ($1) is unsupported." | ||
echo "Please open an issue (PRs welcome ❤️) on:" | ||
echo " https://github.com/lambdaclass/cairo-vm/issues" | ||
echo "" | ||
echo "NOTE: you can still try installing dependencies manually" | ||
echo "If your OS differs from the detected one, you can look \ | ||
for the installation script for your OS in the install-scripts folder." | ||
exit 1 | ||
} | ||
|
||
# Print the detected OS | ||
print_os() { | ||
echo "Detected OS: $1" | ||
} | ||
|
||
# Print a message and run the script | ||
run_script() { | ||
echo "Running $1..." | ||
. $1 | ||
} | ||
|
||
# Detect Linux distro | ||
install_linux() { | ||
# taken from: https://unix.stackexchange.com/a/6348 | ||
# tries different methods to detect the Linux distro | ||
if [ -f /etc/os-release ]; then | ||
# freedesktop.org and systemd | ||
. /etc/os-release | ||
OS=$NAME | ||
VER=$VERSION_ID | ||
elif type lsb_release >/dev/null 2>&1; then | ||
# linuxbase.org | ||
OS=$(lsb_release -si) | ||
VER=$(lsb_release -sr) | ||
elif [ -f /etc/lsb-release ]; then | ||
# For some versions of Debian/Ubuntu without lsb_release command | ||
. /etc/lsb-release | ||
OS=$DISTRIB_ID | ||
VER=$DISTRIB_RELEASE | ||
elif [ -f /etc/debian_version ]; then | ||
# Older Debian/Ubuntu/etc. | ||
OS=Debian | ||
VER=$(cat /etc/debian_version) | ||
elif [ -f /etc/SuSe-release ]; then | ||
# Older SuSE/etc. | ||
OS="Old SuSE" | ||
elif [ -f /etc/redhat-release ]; then | ||
# Older Red Hat, CentOS, etc. | ||
OS="Old RedHat" | ||
else | ||
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc. | ||
OS=$(uname -s) | ||
VER=$(uname -r) | ||
fi | ||
|
||
print_os $OS | ||
|
||
# NOTE: we don't use $VER for now, but this might change | ||
case "$OS" in | ||
Ubuntu*) run_script "install-scripts/install-ubuntu.sh" ;; | ||
Debian*) run_script "install-scripts/install-debian.sh" ;; | ||
*) unsupported_os "linux: $OS" ;; | ||
esac | ||
} | ||
|
||
install_macos() { | ||
print_os "MacOS" | ||
run_script install-scripts/install-macos.sh | ||
} | ||
|
||
case "$OSTYPE" in | ||
linux*) install_linux ;; | ||
darwin*) install_macos ;; | ||
msys*|cygwin*) unsupported_os "Windows" ;; | ||
solaris*) unsupported_os "Solaris" ;; | ||
bsd*) unsupported_os "BSD" ;; | ||
*) unsupported_os "unknown: ${OSTYPE}" ;; | ||
esac |