tvalentyn commented on a change in pull request #12452: URL: https://github.com/apache/beam/pull/12452#discussion_r465195168
########## File path: .github/workflows/python_tests.yml ########## @@ -0,0 +1,196 @@ +# 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. + +name: Python tests + +on: + schedule: + - cron: '10 2 * * *' + push: + branches: ['master', 'release-*'] + tags: 'v*' + pull_request: + branches: ['master', 'release-*'] + tags: 'v*' + paths: ['sdks/python/**', 'model/**'] + + +env: + GCP_WHEELS_STAGING_PATH: "gs://${{ secrets.GCP_BUCKET }}/${GITHUB_REF##*/}/${GITHUB_SHA}-${GITHUB_RUN_ID}/" + GCP_BUCKET: ${{ secrets.GCP_BUCKET }} # beam-wheels-staging + GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} # apache-beam-testing + GCP_REGION: ${{ secrets.GCP_REGION}} # us-central + +jobs: + + build_python_sdk_source: + name: 'Build Python SDK Source' + if: github.repository_owner == 'apache' && (github.event_name == 'push' || github.event_name == 'schedule') + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Install python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Get build dependencies + working-directory: ./sdks/python + run: pip install -r build-requirements.txt + - name: Install wheels + run: pip install wheel + - name: Build source + working-directory: ./sdks/python + run: python setup.py sdist --formats=zip + - name: Add checksums + working-directory: ./sdks/python/dist + run: | + file=$(ls | grep .zip | head -n 1) + sha512sum $file > ${file}.sha512 + - name: Unzip source + working-directory: ./sdks/python + run: unzip dist/$(ls dist | grep .zip | head -n 1) + - name: Rename source directory + working-directory: ./sdks/python + run: mv $(ls | grep apache-beam) apache-beam-source + - name: Upload compressed sources as artifacts + uses: actions/upload-artifact@v2 + with: + name: source_zip + path: sdks/python/dist + + python_unit_tests: + name: 'Python Unit Tests' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + params: [ + {"py_ver": "3.5", "tox_env": "py35"}, + {"py_ver": "3.6", "tox_env": "py36"}, + {"py_ver": "3.7", "tox_env": "py37"}, + {"py_ver": "3.8", "tox_env": "py38"}, + ] + exclude: + # TODO remove exclusion after issue with protobuf is solved + # https://github.com/protocolbuffers/protobuf/issues/7765 + - os: windows-latest + params: {"py_ver": "3.8", "tox_env": "py38"} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Install python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.params.py_ver }} + - name: Get build dependencies + working-directory: ./sdks/python + run: pip install -r build-requirements.txt + - name: Install tox + run: pip install tox + - name: Run tests basic unix + if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') + working-directory: ./sdks/python + run: tox -c tox.ini -e ${{ matrix.params.tox_env }} + - name: Run tests basic windows + if: startsWith(matrix.os, 'windows') + working-directory: ./sdks/python + run: tox -c tox.ini -e ${{ matrix.params.tox_env }}-win + + python_wordcount_direct_runner: + name: 'Python Wordcount Direct Runner' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python: [3.5, 3.6, 3.7, 3.8] Review comment: Is it possible to extract py versions into a constant on top of the file so that we have to modify them in one place when we add/remove a version? ---------------------------------------------------------------- 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]
