Skip to content

Commit

Permalink
Add sonarcloud instructions for the app
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoMoreta committed Apr 27, 2023
1 parent 02b0436 commit 874f596
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
12 changes: 12 additions & 0 deletions technical/app/code-coverage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

Generating App Code Coverage
==============================

#. Start an android emulator.
#. Run the following gradle task::

./gradlew jacocoTestReport

**Note:** This task runs all the app tests and it will take some time to finish, please be patient.

#. When the previous task is finished and all tests succeeded, the coverage report will be located at *'oppia-mobile-android/app/build/report/coverage'*
1 change: 1 addition & 0 deletions technical/app/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ OppiaMobile App
:maxdepth: 1

background-tasks
code-coverage

34 changes: 26 additions & 8 deletions technical/dev/sonarqube.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,32 @@ If you are running with your own SonarCloud account, you'll need to use a differ
OppiaMobile Android App
------------------------

The Oppia app source code analysis can be found at: https://sonarcloud.io/dashboard?id=org.digitalcampus.mobile.learning
The Oppia app source code analysis can be found at: https://sonarcloud.io/project/overview?id=DigitalCampus_oppia-mobile-android

To run the analysis for the app, from the root of the app code directory, run::
To run the analysis for the app, follow these steps:

#. First, you previously need to generate the code coverage. (see: :doc:`../app/code-coverage`).
#. Then, from the root of the app code directory, run::

./gradlew sonarqube

.. note::
You will need to set up the secret sonarcloud token for the previous command to work. There are three different ways to do it:

#. Create an environment variable:

**SONAR_TOKEN=<your_sonarcloud_token>**


#. Create a file named sonarqube.properties in the root of the app code directory. Include the following line inside the file:

**sonar.login=<your_sonarcloud_token>**


#. Include the parameter in the gradlew command:

**./gradlew sonarqube -Dsonar.login=<your_sonarcloud_token>**

./gradlew sonarqube \
-Dsonar.organization=alexlittle-github \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=<login id>
.. note::
To be completed - adding the coverage report
If you want to generate sonarcloud analysis for your own sonarcloud project, make sure to update sonarqube.gradle file
so it includes the information of your project.

0 comments on commit 874f596

Please sign in to comment.