|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +# To learn more about GitHub Actions in Apache Beam check the CI.md |
| 19 | + |
| 20 | +name: Java Tests |
| 21 | + |
| 22 | +on: |
| 23 | + workflow_dispatch: |
| 24 | + inputs: |
| 25 | + runDataflow: |
| 26 | + description: 'Type "true" if you want to run Dataflow tests (GCP variables must be configured, check CI.md)' |
| 27 | + default: false |
| 28 | + schedule: |
| 29 | + - cron: '10 2 * * *' |
| 30 | + push: |
| 31 | + branches: ['master', 'release-*'] |
| 32 | + tags: 'v*' |
| 33 | + pull_request: |
| 34 | + branches: ['master', 'release-*'] |
| 35 | + tags: 'v*' |
| 36 | + paths: ['sdks/java/**', 'model/**', 'runners/**', 'examples/java/**', 'examples/kotlin/**', 'release/**'] |
| 37 | + |
| 38 | + |
| 39 | +jobs: |
| 40 | + |
| 41 | + check_gcp_variables: |
| 42 | + timeout-minutes: 5 |
| 43 | + name: "Check GCP variables set" |
| 44 | + runs-on: ubuntu-latest |
| 45 | + outputs: |
| 46 | + gcp-variables-set: ${{ steps.check_gcp_variables.outputs.gcp-variables-set }} |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v2 |
| 49 | + - name: "Check are GCP variables set" |
| 50 | + run: "./scripts/ci/ci_check_are_gcp_variables_set.sh" |
| 51 | + id: check_gcp_variables |
| 52 | + env: |
| 53 | + GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} |
| 54 | + GCP_SA_EMAIL: ${{ secrets.GCP_SA_EMAIL }} |
| 55 | + GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} |
| 56 | + GCP_TESTING_BUCKET: ${{ secrets.GCP_TESTING_BUCKET }} |
| 57 | + GCP_REGION: "not-needed-here" |
| 58 | + GCP_PYTHON_WHEELS_BUCKET: "not-needed-here" |
| 59 | + |
| 60 | + java_unit_tests: |
| 61 | + name: 'Java Unit Tests' |
| 62 | + runs-on: ${{ matrix.os }} |
| 63 | + strategy: |
| 64 | + fail-fast: false |
| 65 | + matrix: |
| 66 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 67 | + steps: |
| 68 | + - name: Checkout code |
| 69 | + uses: actions/checkout@v2 |
| 70 | + # :sdks:java:core:test |
| 71 | + - name: Run :sdks:java:core:test |
| 72 | + run: ./gradlew :sdks:java:core:test |
| 73 | + - name: Upload test logs for :sdks:java:core:test |
| 74 | + uses: actions/upload-artifact@v2 |
| 75 | + if: always() |
| 76 | + with: |
| 77 | + name: java_unit_tests-sdks-java-core-test-${{ matrix.os }} |
| 78 | + path: sdks/java/core/build/reports/tests/test |
| 79 | + # :sdks:java:harness:test |
| 80 | + - name: Run :sdks:java:harness:test |
| 81 | + if: always() |
| 82 | + run: ./gradlew :sdks:java:harness:test |
| 83 | + - name: Upload test logs for :sdks:java:harness:test |
| 84 | + uses: actions/upload-artifact@v2 |
| 85 | + if: always() |
| 86 | + with: |
| 87 | + name: java_unit_tests-sdks-java-harness-test-${{ matrix.os }} |
| 88 | + path: sdks/java/harness/build/reports/tests/test |
| 89 | + # :runners:core-java:test |
| 90 | + - name: Run :runners:core-java:test |
| 91 | + if: always() |
| 92 | + run: ./gradlew :runners:core-java:test |
| 93 | + - name: Upload test logs for :runners:core-java:test |
| 94 | + uses: actions/upload-artifact@v2 |
| 95 | + if: always() |
| 96 | + with: |
| 97 | + name: java_unit_tests-runners-core-java-test-${{ matrix.os }} |
| 98 | + path: runners/core-java/build/reports/tests/test |
| 99 | + |
| 100 | + java_wordcount_direct_runner: |
| 101 | + name: 'Java Wordcount Direct Runner' |
| 102 | + runs-on: ${{ matrix.os }} |
| 103 | + strategy: |
| 104 | + fail-fast: false |
| 105 | + matrix: |
| 106 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 107 | + steps: |
| 108 | + - name: Checkout code |
| 109 | + uses: actions/checkout@v2 |
| 110 | + - name: Run WordCount Unix |
| 111 | + shell: bash |
| 112 | + run: | |
| 113 | + bash ./gradlew -p examples/ \ |
| 114 | + integrationTest -DintegrationTestPipelineOptions='[ |
| 115 | + "--runner=DirectRunner", "--tempRoot=./tmp" ]' \ |
| 116 | + --tests org.apache.beam.examples.WordCountIT \ |
| 117 | + -DintegrationTestRunner=direct |
| 118 | + - name: Upload test logs |
| 119 | + uses: actions/upload-artifact@v2 |
| 120 | + if: always() |
| 121 | + with: |
| 122 | + name: java_wordcount_direct_runner-${{matrix.os}} |
| 123 | + path: examples/java/build/reports/tests/integrationTest |
| 124 | + |
| 125 | + java_wordcount_dataflow: |
| 126 | + name: 'Java Wordcount Dataflow' |
| 127 | + needs: |
| 128 | + - check_gcp_variables |
| 129 | + runs-on: ${{ matrix.os }} |
| 130 | + if: | |
| 131 | + needs.check_gcp_variables.outputs.gcp-variables-set == 'true' && ( |
| 132 | + (github.event_name == 'push' || github.event_name == 'schedule') || |
| 133 | + (github.event_name == 'workflow_dispatch' && github.event.inputs.runDataflow == 'true') |
| 134 | + ) |
| 135 | + strategy: |
| 136 | + fail-fast: false |
| 137 | + matrix: |
| 138 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 139 | + steps: |
| 140 | + - name: Checkout code |
| 141 | + uses: actions/checkout@v2 |
| 142 | + - name: Authenticate on GCP |
| 143 | + uses: GoogleCloudPlatform/github-actions/setup-gcloud@master |
| 144 | + with: |
| 145 | + service_account_email: ${{ secrets.GCP_SA_EMAIL }} |
| 146 | + service_account_key: ${{ secrets.GCP_SA_KEY }} |
| 147 | + project_id: ${{ secrets.GCP_PROJECT_ID }} |
| 148 | + export_default_credentials: true |
| 149 | + - name: Run WordCount |
| 150 | + shell: bash |
| 151 | + run: | |
| 152 | + bash ./gradlew -p examples/ \ |
| 153 | + integrationTest -DintegrationTestPipelineOptions='[ |
| 154 | + "--runner=DataflowRunner", "--project=${{ secrets.GCP_PROJECT_ID }}", "--tempRoot=gs://${{ secrets.GCP_TESTING_BUCKET }}/tmp/"]' \ |
| 155 | + --tests org.apache.beam.examples.WordCountIT \ |
| 156 | + -DintegrationTestRunner=dataflow |
| 157 | + - name: Upload test logs |
| 158 | + uses: actions/upload-artifact@v2 |
| 159 | + if: always() |
| 160 | + with: |
| 161 | + name: java_wordcount_dataflow-${{matrix.os}} |
| 162 | + path: examples/java/build/reports/tests/integrationTest |
0 commit comments