diff --git a/.github/actions/tr-unit-tests/Dockerfile b/.github/actions/tr-unit-tests/Dockerfile deleted file mode 100644 index 5b73ed5b41..0000000000 --- a/.github/actions/tr-unit-tests/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# -# Licensed 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. -# - -# alpine:3.13 -FROM alpine@sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930 - -RUN apk add --no-cache \ - openjdk11 \ - maven \ - tomcat-native - -ENTRYPOINT cd traffic_router && \ - export JAVA_HOME="$(command -v java | xargs realpath | xargs dirname)/.." && \ - mvn "-Dmaven.repo.local=${GITHUB_WORKSPACE}/.m2/repository" \ - test -Djava.library.path=/usr/share/java diff --git a/.github/actions/tr-unit-tests/README.md b/.github/actions/tr-unit-tests/README.md deleted file mode 100644 index 71f843d0f8..0000000000 --- a/.github/actions/tr-unit-tests/README.md +++ /dev/null @@ -1,54 +0,0 @@ - - -# tr-unit-tests Docker action -This action runs the Traffic Router unit tests in an Alpine Docker container. - -## Inputs - -## Outputs - -### `exit-code` -0 for success, nonzero for failure - -## Example usage -```yaml -jobs: - tests: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@master - - 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 unit tests - uses: ./.github/actions/tr-unit-tests -``` - -To run the tests locally: -```shell -export GITHUB_WORKSPACE='/github/workspace'; -docker build -f .github/actions/tr-unit-tests/Dockerfile -t tr-unit-tests .; -docker run --rm -te GITHUB_WORKSPACE -v "$(pwd):${GITHUB_WORKSPACE}" -w "$GITHUB_WORKSPACE" tr-unit-tests; -``` diff --git a/.github/actions/tr-unit-tests/action.yml b/.github/actions/tr-unit-tests/action.yml deleted file mode 100644 index 6ae7be74c1..0000000000 --- a/.github/actions/tr-unit-tests/action.yml +++ /dev/null @@ -1,22 +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 -# -# 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: tr-unit-tests -description: Runs Traffic Ops unit tests -runs: - using: docker - image: Dockerfile diff --git a/.github/workflows/tpv2.yml b/.github/workflows/tpv2.yml index 7968059e98..c236d102eb 100644 --- a/.github/workflows/tpv2.yml +++ b/.github/workflows/tpv2.yml @@ -22,6 +22,10 @@ env: on: push: + paths: + - experimental/traffic-portal/** + - .github/workflows/tpv2.yml + - .github/actions/tpv2-integration-tests create: pull_request: paths: diff --git a/.github/workflows/tr.unit.tests.yaml b/.github/workflows/tr.tests.yaml similarity index 59% rename from .github/workflows/tr.unit.tests.yaml rename to .github/workflows/tr.tests.yaml index 9e17e3e5ad..764f1b01c9 100644 --- a/.github/workflows/tr.unit.tests.yaml +++ b/.github/workflows/tr.tests.yaml @@ -15,23 +15,27 @@ # specific language governing permissions and limitations # under the License. -name: Traffic Router Unit Tests +name: Traffic Router Tests env: - # alpine:3.13 - ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930 + # 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 + TOMCAT_RELEASE: tomcat_release + TOMCAT_VERSION: tomcat_version on: push: paths: - - .github/actions/tr-unit-tests/** - - .github/workflows/tr.unit.tests.yaml + - .github/workflows/tr.tests.yaml - traffic_router/** create: pull_request: paths: - - .github/actions/tr-unit-tests/** - - .github/workflows/tr.unit.tests.yaml + - .github/workflows/tr.tests.yaml - traffic_router/** types: [ opened, reopened, ready_for_review, synchronize ] @@ -42,40 +46,35 @@ jobs: 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: Install Java dependencies + run: sudo apt -y install libtcnative-1 maven - name: Cache local Maven repository - uses: actions/cache@v2 + uses: actions/cache@v3 with: - path: ${{ github.workspace }}/.m2/repository + path: ~/.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 + - 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 Surefire and Failsafe Reports + uses: actions/upload-artifact@v3 if: ${{ failure() }} with: - name: surefire-reports - path: ${{ github.workspace }}/traffic_router/core/target/surefire-reports/TEST-*.xml + name: junit-reports + path: ${{ github.workspace }}/traffic_router/*/target/*-reports/TEST-*.xml - name: Checkout junit-report-annotations action - uses: actions/checkout@v2 + 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/target/surefire-reports/TEST-*.xml + path: ${{ github.workspace }}/traffic_router/core/*/*-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 }}