| # 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 Unit Tests |
| |
| env: |
| # alpine:3.13 |
| ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930 |
| |
| on: |
| push: |
| paths: |
| - .github/actions/tr-unit-tests/** |
| - .github/workflows/tr.unit.tests.yaml |
| - traffic_router/** |
| create: |
| pull_request: |
| paths: |
| - .github/actions/tr-unit-tests/** |
| - .github/workflows/tr.unit.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: Cache Alpine Docker image |
| uses: actions/cache@v2 |
| with: |
| path: ${{ github.workspace }}/docker-images |
| key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz |
| - name: Import cached Alpine Docker image |
| run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }} |
| - name: Cache local Maven repository |
| uses: actions/cache@v2 |
| with: |
| path: ${{ github.workspace }}/.m2/repository |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| restore-keys: | |
| ${{ runner.os }}-maven- |
| - name: Run Traffic Router unit tests |
| uses: ./.github/actions/tr-unit-tests |
| - name: Upload Surefire Reports |
| uses: actions/upload-artifact@v2 |
| if: ${{ failure() }} |
| with: |
| name: surefire-reports |
| path: ${{ github.workspace }}/traffic_router/core/target/surefire-reports/TEST-*.xml |
| - name: Checkout junit-report-annotations action |
| uses: actions/checkout@v2 |
| 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 |
| uses: ./.github/actions/junit-report-annotations |
| with: |
| path: ${{ github.workspace }}/traffic_router/core/target/surefire-reports/TEST-*.xml |
| numFailures: 999 # The maximum number of test failures to annotate |
| cwd: ${{ github.workspace }}/traffic_router |
| if: always() |
| - name: Save Alpine Docker image |
| run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }} |