pedroeagle/Trabalho-Individual-2020-2

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: Build and Test

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Build application (db, back, front)
      run: |
          python -m pip install --upgrade pip
          pip install coverage
          docker-compose up --build -d
    - name: Lint Backend
      run: |
          docker-compose run back flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=env
          docker-compose run back flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=F401 --exclude=env
    - name: Lint Frontend
      run: docker-compose run front yarn run lint
    - name: Test and coverage Backend
      run: |
            docker-compose run back python manage.py migrate 
            docker-compose run back coverage run manage.py test
    - uses: actions/setup-python@v1
      if: github.ref == 'refs/heads/master'
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CodeClimate }}
    - name: Test and coverage Frontend
      run: |
            docker-compose exec -T front yarn run test:unit:coverage --verbose /usr/src/app/
    - uses: codecov/codecov-action@v1
      if: github.ref == 'refs/heads/master'
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        files: ./client/coverage-final.json