Lambda-School-Labs/Labs26-StorySquad-DS-TeamB

View on GitHub
.github/workflows/ReportCoverage.yml

Summary

Maintainability
Test Coverage
name: Code Climate reporting

on:
  pull_request:
    branches: [ main ]

jobs:
  codeclimate:
    runs-on: ubuntu-latest
    env:
      CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      GOOGLE_CREDS: ${{ secrets.GOOGLE_CREDS }}
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: 3.8
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install coverage pytest
        if [ -f project/requirements.txt ]; then pip install -r project/requirements.txt; fi
    - name: Pre-build Report
      run: |
        curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
        chmod +x ./cc-test-reporter
        ./cc-test-reporter before-build
    - name: Test with pytest and capture coverage report
      run: |
        coverage run -m pytest
    - name: Change ./.coverage to ./coverage.xml
      run: |
        coverage xml
    - name: change coverage.xml to coverage/codeclimate.json
      run: |
        ./cc-test-reporter format-coverage ./coverage.xml --input-type=coverage.py
    - name: Upload the test coverage to code climate
      run: |
        ./cc-test-reporter upload-coverage