Lab: Report Deployment
Steven J Zeil
Abstract
In this assignment, you will automate report generation and deployment (to GitHyb Pages) for your project.
Make sure that you have your GitHub repository from this earlier assignment. The project must include a working Gradle wrapper, can compile and run tests. You need not pass all of the tests.
1 Report Generation
Rebuild your project and examine your working directory again. In build/reports/tests/test
, you should find a nice little collection of files providing a web-ready summary of your unit test performance.
Then try gradle javadoc
. You should find additional web pages now in build/docs
.
Suppose that we wanted to put that up on a project website…
- Make sure that all of your project files are committed and pushed or set to be ignored.
- Create a new branch in your project named
gh-pages
. - Delete all files in that branch. So that
git
knows that this is intentional, use thegit rm
command to do this. - Create a file in the root directory named
index.md
with the following content:# Project Reports Your Name * [Tests](./reports/tests/test/) * [JavaDoc](./docs/javadoc/)
-
Commit and push your new file.
- On GitHub, enter your project’s
Settings
area. SelectPages
.- Due to a policy change at GitHub, you will need to make your GitHub repository public.
Under
ClickSource
, select yourgh-pages
branch. Leave the folder at root.Save
. -
Optionally, choose a Theme for your website. This theme will determine the appearance of Markdown files on your site (in this case, your
index.md
) page. -
Use a web browser to verify that you now have a web site at
https://yourGitHubLogin.github.io/yourProjectName/
You should recognize your “index” page, though the links will not work yet.
2 Deploying Reports
Next, you will add the steps to automatically publish your test and javadoc reports.
- Change back to your project’s main branch.
- Modify your
build.gradle
file to add a task namedreports
. Thereports
task should simply ensure that both thetest
andjavadoc
tasks have been executed. - Modify your
build.gradle
file to add a task nameddeployReports
. This task should- guarantee that the
reports
task has been run - copy the
build/docs/
directory, and all its contents, to thedocs/
directory in yourgh-pages
branch. - copy the
build/reports/
directory, and all its contents, to thereports/
directory in yourgh-pages
branch. - commit all changes to your
gh-pages
branch.
(I recommend doing those first three steps first, testing to be sure that it works as expected, and then adding the commit step only after you are sure that you have the first three steps correct.)
- guarantee that the
- Test your new tasks by running
gradle deployReports
Then use
git status
to check your repository changes. You should see an un-pushed commit to the
gh-pages
branch. -
Commit your changes to
build.gradle
, then push those and yourgh-pages
changes withgit push --all
reports
task should simply ensure that both the test
and javadoc
tasks have been executed.
- Use a web browser to verify that you now have a web site at
https://yourGitHubLogin.github.io/yourProjectName/
Again, you should recognize your “index” page. Verify that the links now work and lead to the appropriate reports.