dtcenter / METdataio

https://metdataio.readthedocs.io/en/latest/index.html
Apache License 2.0
5 stars 3 forks source link

Feature #289 develop sonarqube_gha #290

Closed JohnHalleyGotway closed 5 months ago

JohnHalleyGotway commented 5 months ago

These PR adds SonarQube Scanning to GitHub actions, as described below:

  1. sonarqube.yml defines the new workflow that is triggered by pushes to the develop or main branches, as well as pull requests to those branches. I also added a manual workflow dispatch option, but that won't show up in GitHub until these changes are also made in the main_v2.1 branch. This workflow checks out the code, determines the current branch name, runs a script to set up the SonarQube properties file, and then calls custom actions to perform the scan and check the results.
  2. configure_sonarqube.sh customizes the sonar-project.properties settings for the current run.
  3. sonar-project.properties is updated with template values to be updated by configure_sonarqube.sh and the run_sonarqube.sh script used by the nightly build.
  4. run_sonarqube.sh is the script run during the nightly build. This is updated to handle the newly-parameterized sonar-project.properties file.
  5. Update the PR template to remind PR reviewers to check the SonarQube status.
  6. Delete the internal_tests directory since the SonarQube scanning files were moved from there to internal/scripts/sonarqube (prior to this feature branch) for consistency with other METplus repos.

Note that the scans were enhanced to include the actual code version number rather than just a hard-code string of 1.0.

Please also see this issue comment about a runtime exception. While this exception occurs when running on seneca, it DOES NOT occur when running through GitHub actions. I inspected the log from this run and see on lines 118-121 that no exception occurs:

INFO: Sensor JavaScript inside YAML analysis [javascript] (done) | time=6ms
INFO: Sensor CSS Rules [javascript]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed

Pull Request Testing

Pull Request Checklist

See the METplus Workflow for details.

JohnHalleyGotway commented 5 months ago

@bikegeek and @jprestop, I'm moving this PR from draft to being ready for review. I think I've tied up all the loose ends. I'll submit a similar PR for the main_v2.1 branch to get these changes into the default branch... and then move on to the other METplus repos.

bikegeek commented 5 months ago

I can take a look at it, should we try to get this into the beta4 release?

JohnHalleyGotway commented 5 months ago

@bikegeek, yes, since it came together so quickly and easily, I think I'll try to get all of these changes in for beta4. Working on the companion PR for the main_v2.1 branch now.

bikegeek commented 5 months ago

I will add METreformat to the list of sonar.sources in the sonar-project-properties. There are some tests for the METreformat code, so the code coverage should be >0% if the tests are getting picked up.