diff --git a/.github/workflows/playground_examples_reusable.yml b/.github/workflows/playground_examples_reusable.yml deleted file mode 100644 index d3aa579a3a108..0000000000000 --- a/.github/workflows/playground_examples_reusable.yml +++ /dev/null @@ -1,169 +0,0 @@ -# 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: Playground Examples CI/CD for a given SDK and origin - -on: - workflow_call: - inputs: - step: - type: string - required: true - sdk: - type: string - required: true - subdirs: - type: string - required: true - allowlist: - type: string - required: true - origin: - type: string - required: true -env: - BEAM_VERSION: 2.40.0 -jobs: - check_has_examples: - name: pre-check - runs-on: ubuntu-latest - outputs: - example_has_changed: ${{ steps.check_has_example.outputs.example_has_changed }} - env: - ORIGIN: ${{ inputs.origin }} - SDK: ${{ inputs.sdk }} - STEP: ${{ inputs.step }} - SUBDIRS: ${{ inputs.subdirs }} - steps: - - name: Check out the repo - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-python@v4 - with: - python-version: '3.8' - - name: install deps - run: pip install -r requirements.txt - working-directory: playground/infrastructure - - name: get Difference - id: check_file_changed - run: | - set -xeu - # define the base ref - BASE_REF=$GITHUB_BASE_REF - if [ -z "$BASE_REF" ] || [ "$BASE_REF" == "master" ]; then - BASE_REF=origin/master - fi - DIFF=$(git diff --name-only $BASE_REF $GITHUB_SHA | tr '\n' ' ') - echo "::set-output name=example_diff::$DIFF" - - id: check_has_example - name: has Examples - run: | - # don't quit on errors, check unbound vars, and show commands - set +e -ux - python3 checker.py \ - --verbose \ - --sdk SDK_${SDK^^} \ - --allowlist ${{ inputs.allowlist }} \ - --paths ${{ steps.check_file_changed.outputs.example_diff }} - if [ $? -eq 0 ]; then - echo "::set-output name=example_has_changed::True" - else - echo "::set-output name=example_has_changed::False" - fi - working-directory: playground/infrastructure - env: - BEAM_ROOT_DIR: "../.." - - ci_cd: - name: ${{ inputs.step }} ${{ inputs.sdk }} ${{ inputs.origin }} - needs: [ check_has_examples ] - if: needs.check_has_examples.outputs.example_has_changed == 'True' - runs-on: ubuntu-latest - env: - ORIGIN: ${{ inputs.origin }} - SDK: ${{ inputs.sdk }} - STEP: ${{ inputs.step }} - SUBDIRS: ${{ inputs.subdirs }} - steps: - - name: Check out the repo - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.8' - - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: '8' - - name: install deps - run: pip install -r requirements.txt - working-directory: playground/infrastructure - - name: Remove default github maven configuration - # This step is a workaround to avoid a decryption issue - run: rm ~/.m2/settings.xml - - - name: Set Docker Tag - run: echo "DOCKERTAG=${GITHUB_SHA}" >> $GITHUB_ENV - - name: Set Docker Tag If Github Tag was trigger - run: echo "DOCKERTAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/tags/') - - name: Set docker image - run: echo "IMAGE_TAG=apache/beam_playground-backend-$SDK:$DOCKERTAG" >> $GITHUB_ENV - - - name: Build SDK Backend Docker image - run: | - set -uex - opts="-Pdocker-tag=$DOCKERTAG" - if [ "$SDK" == "java" ]; then - opts="$opts -Pbase-image=apache/beam_java8_sdk:$BEAM_VERSION" - fi - - ./gradlew playground:backend:containers:$SDK:docker $opts - - - name: Start SDK runner in background - run: | - set -uex - NAME=$(docker run -d --rm -p 8080:8080 -e PROTOCOL_TYPE=TCP $IMAGE_TAG) - echo "NAME=$NAME" >> $GITHUB_ENV - - - name: Run ci_cd.py - run: | - python3 ci_cd.py \ - --step $STEP \ - --sdk SDK_${SDK^^} \ - --origin $ORIGIN \ - --subdirs $SUBDIRS - working-directory: playground/infrastructure - env: - BEAM_ROOT_DIR: "../../" - SDK_CONFIG: "../../playground/sdks.yaml" - BEAM_EXAMPLE_CATEGORIES: "../categories.yaml" - SERVER_ADDRESS: localhost:8080 - BEAM_CONCURRENCY: 4 - - - name: Get SDK runner logs - if: ${{ always() }} - run: | - [ -n "$NAME" ] && docker logs $NAME - - - name: Stop/remove SDK runner - if: ${{ always() }} - run: | - [ -n "$NAME" ] && docker rm -f $NAME - - - name: Delete Docker image - if: ${{ always() }} - run: | - docker image rm -f $IMAGE_TAG