-
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] Development environment set up automation #14584
Merged
TheNeuralBit
merged 13 commits into
apache:master
from
benWize:BEAM-11608-dev-env-bash-script
May 29, 2021
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cd53dc9
[BEAM-11608] Add a local setup shell script for Linux and Mac
ebarreraWL b25c3a7
[BEAM-11608] Added GitHub workflow for local-env-setup.sh
ebarreraWL b9b87bd
[BEAM-11608] Added GitHub workflow for local-env-setup.sh (cleaned)
ebarreraWL 2bfeb42
Changed GOPATH behavior. Added extra information on comments.
ebarreraWL 305d7da
Merge branch 'master' of https://github.com/apache/beam into BEAM-116…
ebarreraWL c8b71d5
Fixed GOPATH check
ebarreraWL afa2ed3
[BEAM-11608] Add link to install docs
benWize 59dad43
[BEAM-11608] Moving dependencies list to external file for outside co…
fernando-wizeline 8539d03
[BEAM-11608] backtracking change to build.gradle gcpProject variable
fernando-wizeline 0b57b17
[BEAM-11608] Adding license comment to pkglist file
fernando-wizeline ab8952b
[BEAM-11608] Adding changes suggested in code review
fernando-wizeline dc7c953
[BEAM-11608] Installing virtualenv using pip3
fernando-wizeline 25da8ad
[BEAM-11608] Adding virtualenv dependency to Dockerfile
fernando-wizeline 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# To learn more about GitHub Actions in Apache Beam check the CI.md | ||
|
||
name: Local environment tests | ||
|
||
on: | ||
push: | ||
branches: ['master', 'release-*'] | ||
tags: 'v*' | ||
pull_request: | ||
branches: ['master', 'release-*'] | ||
tags: 'v*' | ||
paths: ['dev-support/**', 'buildSrc/**', '**/build.gradle', 'sdks/python/setup.py', 'sdks/python/tox.ini'] | ||
|
||
jobs: | ||
run_local_env_install_ubuntu: | ||
timeout-minutes: 25 | ||
name: "Ubuntu run local environment shell script" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: "Installing local env dependencies" | ||
run: "sudo ./local-env-setup.sh" | ||
id: local_env_install_ubuntu | ||
- name: "Gradle check" | ||
run: "./gradlew checkSetup" | ||
id: local_env_install_gradle_check_ubuntu | ||
run_local_env_install_mac: | ||
timeout-minutes: 50 | ||
name: "Mac run local environment shell script" | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: "Installing local env dependencies" | ||
run: "./local-env-setup.sh" | ||
id: local_env_install_mac | ||
- name: "Gradle check" | ||
run: "./gradlew checkSetup" | ||
id: local_env_install_gradle_check_mac | ||
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,39 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
bash-completion | ||
build-essential | ||
bzip2 | ||
wget | ||
curl | ||
docker.io | ||
g++ | ||
gcc | ||
git | ||
gnupg-agent | ||
rsync | ||
sudo | ||
vim | ||
locales | ||
wget | ||
time | ||
openjdk-8-jdk | ||
python3-setuptools | ||
python3-pip | ||
python3.6 | ||
python3.7 | ||
python3.8 | ||
tox | ||
docker.io |
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,128 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
darwin_install_pip3_packages() { | ||
echo "Installing setuptools grpcio-tools virtualenv" | ||
pip3 install setuptools grpcio-tools virtualenv | ||
echo "Installing mypy-protobuf" | ||
pip3 install --user mypy-protobuf | ||
} | ||
|
||
install_go_packages(){ | ||
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 | ||
gopathExists=$? | ||
if [ $gopathExists -ne 0 ]; then | ||
export GOPATH=${PWD}/sdks/go/examples/.gogradle/project_gopath && echo "GOPATH was set for this session to '$GOPATH'. Make sure to add this path to your ~/.bashrc file after the execution of this script." | ||
fi | ||
} | ||
|
||
kernelname=$(uname -s) | ||
|
||
# Running on Linux | ||
if [ "$kernelname" = "Linux" ]; then | ||
# Assuming Debian based Linux and the prerequisites in https://beam.apache.org/contribute/ are met: | ||
apt-get update | ||
|
||
echo "Installing dependencies listed in pkglist file" | ||
apt-get install -y $(grep -v '^#' dev-support/docker/pkglist | cat) # pulling dependencies from pkglist file | ||
|
||
type -P python3 > /dev/null 2>&1 | ||
python3Exists=$? | ||
type -P pip3 > /dev/null 2>&1 | ||
pip3Exists=$? | ||
if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then | ||
echo "Installing grpcio-tools mypy-protobuf virtualenv" | ||
pip3 install grpcio-tools mypy-protobuf virtualenv | ||
else | ||
echo "Python3 and pip3 are required but failed to install. Install them manually and rerun the script." | ||
exit | ||
fi | ||
|
||
type -P go > /dev/null 2>&1 | ||
goExists=$? | ||
if [ $goExists -eq 0 ]; then | ||
install_go_packages | ||
else | ||
echo "Go is required. Install it manually from https://golang.org/doc/install and rerun the script." | ||
exit | ||
fi | ||
|
||
# Running on Mac | ||
elif [ "$kernelname" = "Darwin" ]; then | ||
# Check for Homebrew, install if we don't have it | ||
type -P brew > /dev/null 2>&1 | ||
brewExists=$? | ||
if [ $brewExists -ne 0 ]; then | ||
echo "Installing homebrew" | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
fi | ||
|
||
# Update homebrew recipes | ||
echo "Updating brew" | ||
brew update | ||
|
||
# Assuming we are using brew | ||
if brew ls --versions openjdk@8 > /dev/null; then | ||
echo "openjdk@8 already installed. Skipping" | ||
else | ||
echo "Installing openjdk@8" | ||
brew install openjdk@8 | ||
fi | ||
|
||
type -P python3 > /dev/null 2>&1 | ||
python3Exists=$? | ||
type -P pip3 > /dev/null 2>&1 | ||
pip3Exists=$? | ||
if [ $python3Exists -eq 0 -a $pip3Exists -eq 0 ]; then | ||
darwin_install_pip3_packages | ||
else | ||
echo "Python3 and pip3 are required but failed to install. Install them manually and rerun the script." | ||
exit | ||
fi | ||
|
||
type -P tox > /dev/null 2>&1 | ||
toxExists=$? | ||
if [ $toxExists -eq 0 ]; then | ||
echo "tox already installed. Skipping" | ||
else | ||
echo "Installing tox" | ||
brew install tox | ||
fi | ||
|
||
type -P docker > /dev/null 2>&1 | ||
dockerExists=$? | ||
if [ $dockerExists -eq 0 ]; then | ||
echo "docker already installed. Skipping" | ||
else | ||
echo "Installing docker" | ||
brew install --cask docker | ||
fi | ||
|
||
type -P go > /dev/null 2>&1 | ||
goExists=$? | ||
if [ $goExists -eq 0 ]; then | ||
install_go_packages | ||
else | ||
echo "Go is required. Install it manually from https://golang.org/doc/install and rerun the script." | ||
exit | ||
fi | ||
|
||
else echo "Unrecognized Kernel Name: $kernelname" | ||
fi |
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.
Have these been tested?
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.
Hi Brian! Yeah, this has been tested successfully.