You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/11/30 22:54:05 UTC
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7226: Add Unit Tests to Codecov
zrhoffman commented on code in PR #7226:
URL: https://github.com/apache/trafficcontrol/pull/7226#discussion_r1036520185
##########
.github/workflows/go.unit.tests.yaml:
##########
@@ -73,11 +73,177 @@ jobs:
key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- name: Import cached Alpine Docker image
run: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- - name: Run unit tests
+ - name: Run Grove unit tests
uses: ./src/github.com/apache/trafficcontrol/.github/actions/go-test
with:
- dir: ./grove/... ./lib/... ./traffic_monitor/... ./traffic_ops/traffic_ops_golang/... ./cache-config/t3c-generate/... ./traffic_stats/... ./traffic_ops/app/bin/...
+ dir: ./grove/...
+ test_name: grove
env:
GOPATH: /github/workspace
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: grove-coverage.out
+ flags: grove_unit
- name: Save Alpine Docker image
run: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
+
+ go_lib_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ with:
+ fetch-depth: 1
+ path: src/github.com/apache/trafficcontrol
+ - 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: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Go Lib unit tests
+ uses: ./src/github.com/apache/trafficcontrol/.github/actions/go-test
+ with:
+ dir: ./lib/...
+ test_name: golib
+ env:
+ GOPATH: /github/workspace
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: golib-coverage.out
+ flags: golib_unit
+ - name: Save Alpine Docker image
+ run: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
+
+ traffic_monitor_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ with:
+ fetch-depth: 1
+ path: src/github.com/apache/trafficcontrol
+ - 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: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Traffic Monitor unit tests
+ uses: ./src/github.com/apache/trafficcontrol/.github/actions/go-test
+ with:
+ dir: ./traffic_monitor/...
+ test_name: traffic_monitor
+ env:
+ GOPATH: /github/workspace
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: traffic_monitor-coverage.out
+ flags: traffic_monitor_unit
+ - name: Save Alpine Docker image
+ run: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
+
+ traffic_ops_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ with:
+ fetch-depth: 1
+ path: src/github.com/apache/trafficcontrol
+ - 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: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Traffic Ops unit tests
+ uses: ./src/github.com/apache/trafficcontrol/.github/actions/go-test
+ with:
+ dir: ./traffic_ops/traffic_ops_golang/...
+ test_name: traffic_ops
+ env:
+ GOPATH: /github/workspace
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: traffic_ops-coverage.out
+ flags: traffic_ops_unit
+ - name: Save Alpine Docker image
+ run: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
+
+ t3c_generate_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ with:
+ fetch-depth: 1
+ path: src/github.com/apache/trafficcontrol
+ - 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: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run T3C Generate unit tests
+ uses: ./src/github.com/apache/trafficcontrol/.github/actions/go-test
+ with:
+ dir: ./cache-config/t3c-generate/...
+ test_name: t3c_generate
+ env:
+ GOPATH: /github/workspace
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: t3c_generate-coverage.out
+ flags: t3c_generate_unit
+ - name: Save Alpine Docker image
+ run: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
+
+ traffic_stats_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ with:
+ fetch-depth: 1
+ path: src/github.com/apache/trafficcontrol
+ - 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: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Traffic Stats unit tests
+ uses: ./src/github.com/apache/trafficcontrol/.github/actions/go-test
+ with:
+ dir: ./traffic_stats/...
+ test_name: traffic_stats
+ env:
+ GOPATH: /github/workspace
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: traffic_stats-coverage.out
+ flags: traffic_stats_unit
+ - name: Save Alpine Docker image
+ run: src/github.com/apache/trafficcontrol/.github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
Review Comment:
Need a newline at the end of `go.unit.tests.yaml`
##########
.codecov.yml:
##########
@@ -0,0 +1,45 @@
+flags:
+ golib_unit:
+ paths:
+ - ".*"
+ carryforward: true
+ grove_unit:
+ paths:
+ - ".*"
+ carryforward: true
+ t3c_generate_unit:
+ paths:
+ - ".*"
+ carryforward: true
+ traffic_monitor_unit:
+ paths:
+ - ".*"
+ carryforward: true
+ traffic_stats_unit:
+ paths:
+ - ".*"
+ carryforward: true
+ traffic_ops_unit:
+ paths:
+ - ".*"
+ carryforward: true
+ traffic_ops_integration:
+ paths:
+ - ".*"
+ carryforward: true
+ v3:
+ paths:
+ - ".*"
+ carryforward: true
+ v4:
+ paths:
+ - ".*"
+ carryforward: true
+ v5:
+ paths:
+ - ".*"
+ carryforward: true
+
+
+
+
Review Comment:
No need for the extra lines at the end of ` .codecov.yml`
##########
.codecov.yml:
##########
@@ -0,0 +1,45 @@
+flags:
Review Comment:
`..codecov.yml` needs an Apache License header
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org