magefree / mage

Magic Another Game Engine
http://xmage.today
MIT License
1.85k stars 762 forks source link

Integrate code coverage into Travis pipeline and GitHub PR workflow #8246

Open fearphage opened 3 years ago

fearphage commented 3 years ago

This is a follow-up to #6875. Related to https://github.com/magefree/mage/commit/d481172eb4ce193e84156a88339dfdddb2865af9.

Now that coverage exists, we need to upload the results to a service that will track the coverage over time and that integrates with GitHub to share the progress in the pull requests.

The 2 I most commonly come across are:

Both have integrations and examples showing how to integrate into your current Travis workflow. Here are links to the related maven plugins:

JayDi85 commented 3 years ago

As I stated in d481172eb4ce193e84156a88339dfdddb2865af9 -- coverage report can't be enabled in CI process due project size. It takes almost 1 hour on good computer to generate and upload full report to the sonar (on 2023 it takes 10+ hours on default report).

Example: my computer runs tests 2-3 minutes compared to 10 minutes on current travis's CI (coverage + sonar takes 30-60 mins) -- so full coverage report must takes few hours in CI.

Maybe there are possible other way, don't known.

Sonar cloud's track coverage report: https://sonarcloud.io/dashboard?id=JayDi85_mage

shot_210911_133013

JayDi85 commented 3 years ago

You can test integration with local or forked repository. If it works fine then it will be added to current.

JayDi85 commented 1 year ago

Actual static code analysis report by sonarcloud available from that url: https://sonarcloud.io/project/overview?id=magefree_mage or from badges in readme/main github's page.

It also contains a code coverage report by jacoco. I'll updates it manually time by time (once per week/month/etc).

Sonarcloud takes 6+ hours to process whole project on good PC, so it can't be integrated on cloud hosting CI like travis or github actions.

JayDi85 commented 1 year ago

Current workflow for manual build and analysis (run by maven):

  1. Clean and build project:

    mvn clean install -DskipTests
  2. Run tests with code coverage report:

    mvn install -Djacoco.skip=false -Dmaven.test.failure.ignore=true
  3. Run sonarcloud analysis (replace org, project and token by your own):

    mvn -e sonar:sonar -Dsonar.projectKey=magefree_mage -Dsonar.organization=magefree -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=SONAR_ACCESS_HERE