|
| 1 | +# Copyright (c) 2024 Contributors to the Eclipse Foundation |
| 2 | +# |
| 3 | +# See the NOTICE file(s) distributed with this work for additional |
| 4 | +# information regarding copyright ownership. |
| 5 | +# |
| 6 | +# This program and the accompanying materials are made available under the |
| 7 | +# terms of the Apache License, Version 2.0 which is available at |
| 8 | +# https://www.apache.org/licenses/LICENSE-2.0. |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | +# License for the specific language governing permissions and limitations |
| 14 | +# under the License. |
| 15 | +# |
| 16 | +# SPDX-License-Identifier: Apache-2.0 |
| 17 | + |
| 18 | +name: "[BE][TEST][E2E] Cucumber - Association" |
| 19 | + |
| 20 | +on: |
| 21 | + workflow_dispatch: # Trigger manually |
| 22 | + schedule: |
| 23 | + - cron: "0 0 * * *" |
| 24 | + |
| 25 | +jobs: |
| 26 | + build: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Set up JDK 17 |
| 33 | + uses: actions/setup-java@v4 |
| 34 | + with: |
| 35 | + java-version: '17' |
| 36 | + distribution: 'temurin' |
| 37 | + |
| 38 | + - name: Cache maven packages |
| 39 | + uses: actions/cache@v4 |
| 40 | + with: |
| 41 | + path: ~/.m2 |
| 42 | + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
| 43 | + restore-keys: ${{ runner.os }}-m2 |
| 44 | + |
| 45 | + - name: Download Feature Files |
| 46 | + id: download |
| 47 | + env: |
| 48 | + JIRA_USERNAME: ${{ secrets.ASSOCIATION_TX_JIRA_USERNAME }} |
| 49 | + JIRA_PASSWORD: ${{ secrets.ASSOCIATION_TX_JIRA_PASSWORD }} |
| 50 | + # JIRA filter 11349: project = "[TR] FOSS - Open Source (Impl.)" AND issuetype = Test AND "Test Type" = Cucumber AND status = Ready AND labels = INTEGRATION_TEST AND (environment ~ DEV OR environment ~ "INT") |
| 51 | + # Downloads all feature files of cucumber tests inside TRI project |
| 52 | + run: | |
| 53 | + token=$(curl -H "Content-Type: application/json" -X POST \ |
| 54 | + --data "{ \"client_id\": \"$JIRA_USERNAME\",\"client_secret\": \"$JIRA_PASSWORD\" }" \ |
| 55 | + https://xray.cloud.getxray.app/api/v2/authenticate | tr -d '"') |
| 56 | +
|
| 57 | + export HTTP_RESULT=$(curl -s --show-error -w "%{http_code}" --header "Authorization: Bearer $token" \ |
| 58 | + "https://xray.cloud.getxray.app/api/v2/export/cucumber?filter=10005&fz=true" -o features.zip) |
| 59 | +
|
| 60 | + [[ $HTTP_RESULT == 200 || $HTTP_RESULT == 400 ]] |
| 61 | + echo "::set-output name=http_response::$HTTP_RESULT" |
| 62 | +
|
| 63 | + - name: install tx-models |
| 64 | + run: mvn install -pl tx-models |
| 65 | + |
| 66 | + # Required step due to fact that jira will name feature files differently with each feature added and that will cause duplicate test runs |
| 67 | + - name: Cleanup repository feature files |
| 68 | + if: ${{ steps.download.outputs.http_response == '200' }} |
| 69 | + #working-directory: tx-cucumber-tests |
| 70 | + run: | |
| 71 | + rm -r tx-cucumber-tests/src/test/resources/features/* |
| 72 | +
|
| 73 | + - name: Build with Maven |
| 74 | + if: ${{ steps.download.outputs.http_response == '200' }} |
| 75 | + env: |
| 76 | + KEYCLOAK_HOST: ${{ secrets.ASSOCIATION_KEYCLOAK_HOST }} |
| 77 | + SUPERVISOR_CLIENT_ID: ${{ secrets.ASSOCIATION_SUPERVISOR_CLIENT_ID }} |
| 78 | + SUPERVISOR_PASSWORD: ${{ secrets.ASSOCIATION_SUPERVISOR_PASSWORD }} |
| 79 | + E2E_TXA_HOST: ${{ secrets.ASSOCIATION_E2E_TXA_HOST }} |
| 80 | + E2E_TXB_HOST: ${{ secrets.ASSOCIATION_E2E_TXB_HOST }} |
| 81 | + #working-directory: tx-cucumber-tests |
| 82 | + run: | |
| 83 | + unzip -o tx-cucumber-tests/features.zip -d tx-cucumber-tests/src/test/resources/features |
| 84 | + mvn -pl tx-models,tx-cucumber-tests --batch-mode clean install -D"cucumber.filter.tags"="@trace-x-automated" -P association |
| 85 | +
|
| 86 | + - name: Submit results to Xray |
| 87 | + if: ${{ always() && steps.download.outputs.http_response == '200' }} |
| 88 | + env: |
| 89 | + JIRA_USERNAME: ${{ secrets.ASSOCIATION_TX_JIRA_USERNAME }} |
| 90 | + JIRA_PASSWORD: ${{ secrets.ASSOCIATION_TX_JIRA_PASSWORD }} |
| 91 | + run: | |
| 92 | + token=$(curl -H "Content-Type: application/json" -X POST \ |
| 93 | + --data "{ \"client_id\": \"$JIRA_USERNAME\",\"client_secret\": \"$JIRA_PASSWORD\" }" \ |
| 94 | + https://xray.cloud.getxray.app/api/v2/authenticate | tr -d '"') |
| 95 | +
|
| 96 | + curl --request POST \ |
| 97 | + --header 'Content-Type: application/json' \ |
| 98 | + --header "Authorization: Bearer $token" \ |
| 99 | + --data-binary '@tx-cucumber-tests/report.json' \ |
| 100 | + "https://xray.cloud.getxray.app/api/v2/import/execution/cucumber" |
0 commit comments