-
Notifications
You must be signed in to change notification settings - Fork 164
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: improve dependency installation experience #1298
Merged
Merged
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c64cea4
Add installation instructions to README
MegaRedHand 32c1680
Add compilation step to installation testing
MegaRedHand db1c9a3
Add script for universal dependency installation
MegaRedHand dfd1c8f
Update changelog
MegaRedHand 3a52a42
Enable test_install workflow only on main
MegaRedHand 04ae709
Update optional dependencies
MegaRedHand 22d2ac6
Don't compile, only check
MegaRedHand 98de9e8
Push again
MegaRedHand bfe9f88
Use swatinem cache
MegaRedHand e72b176
Cache all crates even on failure
MegaRedHand 1cbc041
Fix debian rust cache
MegaRedHand 28e9ca5
Use manual cache
MegaRedHand 6a68c9a
Test cache
MegaRedHand cf9f9a7
Merge branch 'main' into better-installation-experience
MegaRedHand 9af1c08
Cache cairo compiler
MegaRedHand d2a1728
Add pyenv dependency caching
MegaRedHand 6030c72
Cache pip instead of pyenv
MegaRedHand 60ac9ac
Try fixing cache
MegaRedHand 7362bd9
Use setup-python action
MegaRedHand 9c4631e
Use ~ instead of ${HOME}
MegaRedHand b15d1d8
Use manual cache in Debian container
MegaRedHand d0d413e
Add some comments
MegaRedHand 8aedff4
Make cache owned by current user and add logs
MegaRedHand eaf9891
Merge branch 'main' into better-installation-experience
MegaRedHand ee7ce53
Remove python install from script
MegaRedHand 30da4a4
Merge branch 'main' into better-installation-experience
MegaRedHand 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
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 |
---|---|---|
|
@@ -26,4 +26,3 @@ source ~/cairo_venv/bin/activate | |
|
||
# Install cairo & its dependencies | ||
pip3 install -r requirements.txt | ||
|
||
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,86 @@ | ||
#!/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 | ||
|
||
make deps | ||
} | ||
|
||
install_macos() { | ||
print_os "MacOS" | ||
run_script install-scripts/install-macos.sh | ||
|
||
make deps-macos | ||
} | ||
|
||
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 |
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.
I think we should install
pyenv install 3.9.15
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.
Also, this isn't duplicated? Since then
install_macos
runsmake deps-macos
But we can leave it duplicate because
make deps-macos
won't fail.What we need to check is to add the
CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib
before the pip installThere 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.
Good catch! Removed the whole Python install 👍