| # 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 |
| # |
| # https://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: Traffic Router Tests |
| |
| env: |
| # environment variables for traffic_router_rpm |
| BUILD_LOCK: build_lock |
| BUILD_NUMBER: build_number |
| RHEL_VERSION: rhel_version |
| STARTUP_SCRIPT_DIR: /startup-dir |
| STARTUP_SCRIPT_LOC: ../core/src/main/lib/systemd/system |
| LOGROTATE_SCRIPT_DIR: /etc/logrotate.d |
| LOGROTATE_SCRIPT_LOC: ../core/src/main/lib/logrotate |
| #TOMCAT_VERSION: (set from .env) |
| |
| on: |
| push: |
| paths: |
| - .github/workflows/tr.tests.yaml |
| - traffic_router/** |
| pull_request: |
| paths: |
| - .github/workflows/tr.tests.yaml |
| - traffic_router/** |
| types: [ opened, reopened, ready_for_review, synchronize ] |
| |
| jobs: |
| tests: |
| if: github.event.pull_request.draft == false |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout |
| uses: actions/checkout@master |
| - name: Load environment # This loads TOMCAT_VERSION into the environment. |
| run: cp .env '${{ github.env }}' |
| - name: Install Java dependencies |
| run: sudo apt -y install libtcnative-1 maven |
| - name: Cache local Maven repository |
| uses: actions/cache@v3 |
| with: |
| path: ~/.m2/repository |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| restore-keys: | |
| ${{ runner.os }}-maven- |
| - name: Run Traffic Router tests |
| run: mvn -Djava.library.path=/usr/lib/x86_64-linux-gnu verify |
| working-directory: ${{ github.workspace }}/traffic_router |
| - name: Upload coverage to Codecov |
| uses: codecov/codecov-action@v3 |
| with: |
| files: core/target/site/jacoco-aggregate/jacoco.xml |
| flags: traffic_router_unit |
| - name: Upload Surefire and Failsafe Reports |
| uses: actions/upload-artifact@v4 |
| if: ${{ failure() }} |
| with: |
| name: junit-reports |
| path: ${{ github.workspace }}/traffic_router/*/target/*-reports/TEST-*.xml |
| - name: Checkout junit-report-annotations action |
| if: ${{ always() }} |
| uses: actions/checkout@v3 |
| with: |
| repository: zrhoffman/junit-report-annotations-action |
| ref: 399056ab38c3da69c5b27f924357e10aec3caf8f # Fri Sep 25 02:02:53 2020 -0600 Make all properties string type (see actions/toolkit#398) |
| path: .github/actions/junit-report-annotations |
| - name: Convert Junit Report to Annotations |
| if: ${{ always() }} |
| uses: ./.github/actions/junit-report-annotations |
| with: |
| path: ${{ github.workspace }}/traffic_router/core/*/*-reports/TEST-*.xml |
| numFailures: 999 # The maximum number of test failures to annotate |
| cwd: ${{ github.workspace }}/traffic_router |