rafaelteodosio/Trabalho-Individual-2020-2

View on GitHub
.github/workflows/main.yml

Summary

Maintainability
Test Coverage
name: Integração Continua

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build Da Aplicação
        run: docker-compose up -d app
        
  Back-End-Testes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Testes do Back-End(API)
        run: docker-compose run api python3 manage.py test
        
  Front-End-Testes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Testes do Front-End(Cliente)
        run: docker-compose run app bash -c "yarn && yarn test:unit"
        
  Back-End-Stylesheet:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Stylesheet do Back-End(API)
        run: docker-compose run api bash -c "pylint *.py"
        
  Front-End-Stylesheet:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Stylesheet do Front-end(Cliente)
        run: docker-compose run app bash -c "yarn && yarn lint"
        
  Back-End-Test-Coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Cobertura de código do Back-End
        run: |
           docker-compose run api bash -c "coverage run --source='.' manage.py test"
           docker-compose run api bash -c "coverage xml"
             
      - name: CodeCov Back-End
        uses: codecov/codecov-action@v1
        with:
          token: ${{secrets.CODECOV_TOKEN}}
          files: ./api/coverage.xml
          flags: Back-End-Cov
          fail_ci_if_error: true
             
  Front-End-Test-Coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Cobertura de código do Front-End
        run: docker-compose run app bash -c "yarn && yarn test:unit:ci:coverage"
             
      - name: CodeCov Front-End
        uses: codecov/codecov-action@v1
        with:
          token: ${{secrets.CODECOV_TOKEN}}
          files: ./client/test/jest/coverage/coverage-final.json
          flags: Front-End-Cov
          fail_ci_if_error: true