Steps to measure coverage and get badges on codecov.io

Caution

Codeclimate.com can now analyze coverage as well as maintainability. Engineering Metrics to Improve Continuous Delivery Practices | Velocity

Just in case, I'll leave the codecov.io steps here. The Leading Code Coverage Solution | Codecov

procedure

1. Set up GitHub Actions in the GitHub repository

Here, we will explain using Pipenv in a Python project as an example. Create a new .github/workflows/analyze.yml and copy the following code.

on:
  push:
    branches:
      - master
jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: '3.8'
      - run: python -m pip install pipenv
      - run: python -m pipenv sync --dev
      - run: python -m pipenv run coverage_xml
      - uses: codecov/codecov-action@v1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          file: ./coverage.xml
          fail_ci_if_error: true

Output Coverage as XML in some way, Upload to codecov.io using the following GitHub Actions Codecov · Actions · GitHub Marketplace

2. Associate codecov.io with the GitHub repository

2-1. Log in to codecov.io and click the ʻAdd new repository` button The Leading Code Coverage Solution | Codecov

2-2. Click on the target repository

2-3. The Repository Upload Token is displayed. Copy it to the clipboard.

2-4. Go to the GitHub repository and Click Settings-> Secrets-> ʻAdd new secret`

2-5. Enter the following in the form and click the ʻAdd secret` button

Name: “CODECOV_TOKEN” Value: Paste the string copied in step 4.

Recommended Posts

Steps to measure coverage and get badges on codecov.io
Steps to deploy EMLauncher on CentOS 8
Python 3.6 on Windows ... and to Xamarin.
Steps to install matplotlib on Mac
Steps to install VirtualBox on CentOS
Steps to install python3 on mac
Steps to run Google Chrome headless on EC2 Ubuntu and take screenshots
Get exchange rates on Heroku regularly and upload logs to Amazon S3
Build Linux on a Windows environment. Steps to install Laradock and migrate
Steps to install Python environment on Ubuntu
Program to get favorite images on Twitter
Steps to build PyTorch 1.5 for CUDA 10.2 on Windows
Steps to attach and debug from VS Code to Jupyter Lab on a remote server
Steps to quickly create a deep learning environment on Mac with TensorFlow and OpenCV