From 8fb4fbeb93fcb1d6c56a850ee4aa7572eb587dc9 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 29 Sep 2021 21:09:22 +0200 Subject: [PATCH] CI for backend unit tests and coverage --- .github/workflows/test.yml | 44 +++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbf7e807e..1db30c685 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -328,7 +328,7 @@ jobs: docker run -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test cp -r ~/coverage ./coverage ########################################################################## - # COVERAGE REPORT FRONTEND ################################################ + # COVERAGE REPORT FRONTEND ############################################### ########################################################################## #- name: frontend | Coverage report # uses: romeovs/lcov-reporter-action@v0.2.21 @@ -347,6 +347,48 @@ jobs: min_coverage: 67 token: ${{ github.token }} + ############################################################################## + # JOB: UNIT TEST BACKEND #################################################### + ############################################################################## + unit_test_backend: + name: Unit tests - Backend + runs-on: ubuntu-latest + needs: [build_test_backend] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # DOWNLOAD DOCKER IMAGES ################################################# + ########################################################################## + - name: Download Docker Image (Backend) + uses: actions/download-artifact@v2 + with: + name: docker-backend-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/frontend.tar + ########################################################################## + # UNIT TESTS BACKEND ##################################################### + ########################################################################## + - name: backend | Unit tests + run: | + docker run -v ~/coverage:/app/coverage --rm gradido/backend:test yarn run test + cp -r ~/coverage ./coverage + ########################################################################## + # COVERAGE CHECK BACKEND ################################################# + ########################################################################## + - name: backend | Coverage check + uses: webcraftmedia/coverage-check-action@master + with: + report_name: Coverage Backend + type: lcov + result_path: ./coverage/lcov.info + min_coverage: 0 + token: ${{ github.token }} + ############################################################################## # JOB: UNIT TEST LOGIN-SERVER ############################################### ##############################################################################