Merge pull request #158 from gradido/coverage-check

feat: Add Coverage Check To GitHub Workflow
This commit is contained in:
Ulf Gebhardt 2021-04-13 23:42:54 +02:00 committed by GitHub
commit 6cba3df7ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,32 +30,6 @@ jobs:
name: docker-frontend-test
path: /tmp/frontend.tar
##############################################################################
# JOB: DOCKER BUILD TEST BACKEND #############################################
##############################################################################
#build_test_backend:
# name: Docker Build Test - Backend
# runs-on: ubuntu-latest
# needs: [prepare]
# steps:
# ##########################################################################
# # CHECKOUT CODE ##########################################################
# ##########################################################################
# - name: Checkout code
# uses: actions/checkout@v2
# ##########################################################################
# # BUILD BACKEND DOCKER IMAGE (build) #####################################
# ##########################################################################
# - name: backend | Build `test` image
# run: |
# docker build --target test -t "ocelotsocialnetwork/backend:test" backend/
# docker save "ocelotsocialnetwork/backend:test" > /tmp/backend.tar
# - name: Upload Artifact
# uses: actions/upload-artifact@v2
# with:
# name: docker-backend-test
# path: /tmp/backend.tar
##############################################################################
# JOB: DOCKER BUILD TEST LOGIN SERVER ########################################
##############################################################################
@ -139,80 +113,6 @@ jobs:
- name: frontend | Lint
run: docker run --rm gradido/frontend:test yarn run lint
##############################################################################
# JOB: LINT WEBAPP ###########################################################
##############################################################################
#lint_webapp:
# name: Lint webapp
# runs-on: ubuntu-latest
# needs: [build_test_webapp]
# steps:
# ##########################################################################
# # CHECKOUT CODE ##########################################################
# ##########################################################################
# - name: Checkout code
# uses: actions/checkout@v2
# ##########################################################################
# # DOWNLOAD DOCKER IMAGE ##################################################
# ##########################################################################
# - name: Download Docker Image (Webapp)
# uses: actions/download-artifact@v2
# with:
# name: docker-webapp-test
# path: /tmp
# - name: Load Docker Image
# run: docker load < /tmp/webapp.tar
# ##########################################################################
# # LINT WEBAPP ############################################################
# ##########################################################################
# - name: webapp | Lint
# run: docker run --rm ocelotsocialnetwork/webapp:test yarn run lint
##############################################################################
# JOB: UNIT TEST BACKEND #####################################################
##############################################################################
#unit_test_backend:
# name: Unit tests - backend
# runs-on: ubuntu-latest
# needs: [build_test_neo4j,build_test_backend]
# steps:
# ##########################################################################
# # CHECKOUT CODE ##########################################################
# ##########################################################################
# - name: Checkout code
# uses: actions/checkout@v2
# ##########################################################################
# # DOWNLOAD DOCKER IMAGES #################################################
# ##########################################################################
# - name: Download Docker Image (Neo4J)
# uses: actions/download-artifact@v2
# with:
# name: docker-neo4j-image
# path: /tmp
# - name: Load Docker Image
# run: docker load < /tmp/neo4j.tar
# - 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/backend.tar
# ##########################################################################
# # UNIT TESTS BACKEND #####################################################
# ##########################################################################
# # TODO: Why do we need those .envs?
# - name: backend | copy env files webapp
# run: cp webapp/.env.template webapp/.env
# - name: backend | copy env files backend
# run: cp backend/.env.template backend/.env
# - name: backend | docker-compose
# run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps neo4j backend
# - name: backend | Initialize Database
# run: docker-compose exec -T backend yarn db:migrate init
# - name: backend | Unit test
# run: docker-compose exec -T backend yarn test
##############################################################################
# JOB: UNIT TEST FRONTEND ###################################################
##############################################################################
@ -229,7 +129,7 @@ jobs:
##########################################################################
# DOWNLOAD DOCKER IMAGES #################################################
##########################################################################
- name: Download Docker Image (Webapp)
- name: Download Docker Image (Frontend)
uses: actions/download-artifact@v2
with:
name: docker-frontend-test
@ -240,9 +140,29 @@ jobs:
# UNIT TESTS FRONTEND ####################################################
##########################################################################
- name: frontend | Unit tests
run: docker run --rm gradido/frontend:test yarn run test
run: |
docker run -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test
cp -r ~/coverage ./coverage
##########################################################################
# COVERAGE REPORT FRONTEND ################################################
##########################################################################
# TODO: Maybe remove this later on to avoid spam?
- name: frontend | Coverage report
uses: romeovs/lcov-reporter-action@v0.2.21
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: ./coverage/lcov.info
##########################################################################
# COVERAGE CHECK FRONTEND ################################################
##########################################################################
- name: frontend | Coverage check
uses: devmasx/coverage-check-action@v1.2.0
with:
type: lcov
result_path: ./coverage/lcov.info
min_coverage: 10
token: ${{ github.token }}
#test:
# runs-on: ubuntu-latest
# steps: