Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best practice to access the lcov file from base branch? #35

Open
nilsreichardt opened this issue Dec 28, 2021 · 2 comments
Open

Best practice to access the lcov file from base branch? #35

nilsreichardt opened this issue Dec 28, 2021 · 2 comments

Comments

@nilsreichardt
Copy link

Is there an example how to access in a good & easy way the lcov file from the base branch?

@nilsreichardt
Copy link
Author

My current approach is:

  1. Create coverage report for head branch
  2. Rename this file
  3. Checkout to base branch
  4. Create coverage report for base branch
      - name: Run tests
        working-directory: ${{ env.WORKING_DIRECTORY }}
        run: |
          npm install -g nyc
          npm run ci

      - name: Create Coverage Report for base branch
        run: |
          mv $WORKING_DIRECTORY/coverage/lcov.info $WORKING_DIRECTORY/coverage/lcov_head.info
          git fetch
          git checkout origin/${{ github.event.pull_request.base.ref }}
          cd $WORKING_DIRECTORY && npm run ci

      - name: Post Coverage Report
        uses: romeovs/[email protected]
        with:
          lcov-file: "${{ env.WORKING_DIRECTORY }}/coverage/lcov_head.info"
          lcov-base: "${{ env.WORKING_DIRECTORY }}/coverage/lcov.info"
          github-token: "${{ secrets.GITHUB_TOKEN }}"
          delete-old-comments: true

@keremciu
Copy link

great! @nilsreichardt I was looking for a solution in my fork, I would try it out some stuff to make it a good PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants