0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Codecovを活用してカバレッジを可視化する

Posted at

カバレッジとは

プロダクションコードのうち、どのくらいテストが実行されているかを割合で見たもの。

codeカバレッジを見る意義

プロダクションコードに関して、コードカバレッジを恒常的に可視化しておくことで、PRを立てた際にカバレッジの低下に気づくことが可能となり、テストコードによって動作確認がきちんと行われていないプロダクションコードのmain ブランチへのmergeを未然に防ぐことができる様になります。

codecov をGitHub Actionsで利用する

      - name: Run tests
        run: go test -coverprofile=cover.out ./...
        env:
          AWS_S3_BUCKET: ${{ env.AWS_S3_BUCKET }}
          AWS_ACCESS_KEY: localstack
          AWS_SECRET_KEY: localstack
          AWS_REGION: ${{ env.AWS_REGION }}
          AWS_END_POINT_URL: ${{ env.AWS_END_POINT_URL }}

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v2
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          flags: backend-go
codecov:
  notify:
    require_ci_to_pass: yes

coverage:
  status:
    project:
      default:
        target: 60%
    patch: no
    changes: no

comment:
  layout: "reach, diff, flags, flags, files, footer"
  behavior: default

flags:
  backend-go:
    paths:
      - src/backend-go

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?