Before you start Lab 7, make sure you set up the project correctly:
- Download the project as a zip file from GitHub & unzip it.
- Create a new GitHub repository and push the template code to it.
Configure the GitHub Actions pipeline to execute all backend tests automatically on every push or pull request.
The environment-related test in Lab7Test.java depends on the MY_SECRET_KEY environment variable, so it must be provided through GitHub Secrets.
Steps to configure it:
- In your GitHub repository, navigate to Settings > Secrets and variables > Actions.
- Create a new repository secret with the following details:
- Name:
MY_SECRET_KEY - Value:
ABC
- Name:
- Modify the existing GitHub Actions pipeline for the Gradle test task so that it passes this secret as an environment variable during test execution.
Important:
- Make sure the test is active by removing the
@Disabledannotation from theenvironment()test. - It's fine if the test fails on your local machine since you did not set the environment variable.
JaCoCo is already set up in build.gradle for generating code coverage reports.
Note: You can run it locally from build.gradle -> jacocoTestReport. The JaCoCo report is generated in the build/reports/jacoco/test/html directory and can visualize it in your browser by opening index.html.
Modify the pipeline so that the JaCoCo report task is executed as part of the CI workflow.
The workflow should be triggered only when pushing on a specific branch (for example, test).
How to create a new branch on GitHub & how to switch to it locally:
- Create a new branch on GitHub by clicking on 1 Branch, then click on New branch and give it a suitable name.

- In your local repository, switch to the new branch by running
git checkout branch-name. Replacebranch-namewith the name of the branch you created.
You can check the branch you are currently on by running git branch.