TheNeuralBit commented on a change in pull request #14584: URL: https://github.com/apache/beam/pull/14584#discussion_r633793069
########## File path: local-env-setup.sh ########## @@ -0,0 +1,125 @@ +#!/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 + 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 +} + +# Running on Linux +if [ "$(uname -s)" = "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" + pip3 install grpcio-tools mypy-protobuf + 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 +fi + +# Running on Mac +if [ "$(uname -s)" = "Darwin" ]; then Review comment: Perhaps this should be structured as: ``` kernelname = $(uname -s) if kernelname == "Linux" ... elseif kernelname == "Darwin" ... else echo "Unrecognized Kernel Name: $kernelname" ``` Right now if we don't hit either if the script just exits silently. ########## File path: .github/workflows/local_env_tests.yml ########## @@ -0,0 +1,60 @@ +# 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: ['sdks/python/**', 'model/**'] + workflow_dispatch: + inputs: + runDataflow: + description: 'Type "true" if you want to run Dataflow tests (GCP variables must be configured, check CI.md)' + default: false + +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 Review comment: Have these been tested? ########## File path: dev-support/docker/Dockerfile ########## @@ -42,32 +42,11 @@ ENV DEBCONF_TERSE true ### RUN apt -q update \ && apt install -y software-properties-common apt-utils apt-transport-https ca-certificates \ - && add-apt-repository -y ppa:deadsnakes/ppa \ - && apt-get -q install -y --no-install-recommends \ - 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 \ - virtualenv \ - tox + && add-apt-repository -y ppa:deadsnakes/ppa + +RUN mkdir /package +COPY pkglist /package/pkglist +RUN apt-get -q install -y --no-install-recommends $(grep -v '^#' /package/pkglist | cat) Review comment: Could this just copy local_env_setup.sh and execute it? I suppose the only thing that would let us remove here would be `RUN pip3 install grpcio-tools mypy-protobuf`, so maybe it's not worth it. ########## File path: .github/workflows/local_env_tests.yml ########## @@ -0,0 +1,60 @@ +# 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: ['sdks/python/**', 'model/**'] + workflow_dispatch: + inputs: + runDataflow: + description: 'Type "true" if you want to run Dataflow tests (GCP variables must be configured, check CI.md)' + default: false Review comment: This looks like a copy-paste error, I don't think a `runDataflow` input is relevant here. ########## File path: .github/workflows/local_env_tests.yml ########## @@ -0,0 +1,60 @@ +# 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: ['sdks/python/**', 'model/**'] Review comment: This looks like a copy-paste error, I don't think we should restrict this to run only when the Python SDK changes. I'm not sure if there's a reasonable set of paths we can restrict this to, we may just want to run it on every PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
