-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[BEAM-11608] Add a local setup shell script for Linux and Mac #14475
[BEAM-11608] Add a local setup shell script for Linux and Mac #14475
Conversation
Is it possible to add tests for this? For example, can we run this using github actions in a linux/mac environment and then run a few of the gradle check commands? Will it be possible for this script to be used for snippets in the documentation in the contributor guide? |
@tysonjh added the GitHub actions tests for Linux and Mac. |
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.
Looking good! A few comments, plus I'd like Robert to take a look at the Go related config.
R: @lostluck
local-env-setup.sh
Outdated
# The following source command will not work if executed in a subshell like $ ./this_script.sh. Instead, we need to run it in the current shell as $ . ./this_script.sh. | ||
# However, this is just to load the GOPATH env variable from the previosu command into the current shell. If that's not required, then we can suggest a terminal reload after the execution? | ||
#source ~/.bashrc |
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.
Is any of this relevant any more or can it be removed?
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.
it's not relevant anymore, removed.
local-env-setup.sh
Outdated
echo "Installing goavro" | ||
go get github.com/linkedin/goavro | ||
# As we are using bash, we are assuming .bashrc exists. | ||
grep -qxF "export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath'" ~/.bashrc || echo "export GOPATH='${pwd}/sdks/go/examples/.gogradle/project_gopath'" >> ~/.bashrc |
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.
Is it possible to set GOPATH
in this script, but not write it to .bashrc
? I'm a little worried about messing around with .bashrc
files automatically.
We could,
- check if GOPATH is set already
- if not, set it locally in this script, print out a line to the user telling them to add it to their bashrc file
@lostluck could you review the go related config please?
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.
Changed the logic to set the GOPATH
variable only for the script session if it's not found in .bashrc
and added an echo
to remind the user to add it manually.
local-env-setup.sh
Outdated
echo "Installing grpcio-tools and mypy-protobuf" | ||
pip3 install grpcio-tools mypy-protobuf virtualenv | ||
else | ||
echo "Python3 and pip3 are required. Installation Failed." |
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.
These were installed earlier on line 41 right? That means the installation failed for some reason. Maybe a bit more info in the message would be helpful:
echo "Python3 and pip3 are required. Installation Failed." | |
echo "Python3 and pip3 are required but failed to install. Install them manually and rerun the script." |
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.
Line 41 installed pip3 and other tools, then we use pip3 to install additional libraries with it.
Added additional info to the echo
to make it explicit that the library is required.
local-env-setup.sh
Outdated
if [ $goExists -eq 0 ]; then | ||
install_go_packages | ||
else | ||
echo "Go is required. Installation Failed." |
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.
Same here, add more info in the error message.
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.
Fixed.
local-env-setup.sh
Outdated
if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then | ||
darwin_install_pip3_packages | ||
else | ||
echo "Python3 and pip3 are required. Installation Failed." |
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.
Same here, add more info.
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.
Fixed.
local-env-setup.sh
Outdated
if [ $goExists -eq 0 ]; then | ||
install_go_packages | ||
else | ||
echo "Go is required. Installation Failed." |
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.
Same here, add more info.
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.
Fixed.
sdks/go/examples/build.gradle
Outdated
@@ -77,3 +77,10 @@ golang { | |||
continueOnFailure = true | |||
} | |||
} | |||
|
|||
// Run this task to validate the Go environment setup for contributors |
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.
No need to add these any more since they're added in https://github.com/apache/beam/pull/14467/files ?
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.
True. I merged the master (which already has these changes) with this branch to remove this from my PR.
sdks/python/build.gradle
Outdated
@@ -110,3 +110,15 @@ task startPortableRunner { | |||
} | |||
} | |||
} | |||
|
|||
// Run this task to validate the python environment setup for contributors | |||
task wordCount { |
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.
Same?
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.
Fixed.
if [ $goExists -eq 0 ]; then | ||
install_go_packages | ||
else | ||
echo "Go is required. Install it manually and rerun the script." |
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.
Consider adding the link to the install docs: https://golang.org/doc/install
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.
Thanks, I will continue the work from here.
Solved in #14584
if [ $goExists -eq 0 ]; then | ||
install_go_packages | ||
else | ||
echo "Go is required. Install it manually and rerun the script." |
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.
Consider adding the link to the install docs: https://golang.org/doc/install
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.
Solved in #14584
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.
LGTM! Thank you.
Is it possible to de-dupe this with the logic for the development container defined in For example, could we use this script to install requirements within the development container? |
Closing this in favor of #14584 |
Added local-env-setup.sh to automate the installation of local environment dependencies for new Beam users.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.