Lab: Report Deployment

Steven J Zeil

Last modified: Jan 7, 2022
Contents:

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…

  1. Make sure that all of your project files are committed and pushed or set to be ignored.
  2. Create a new branch in your project named gh-pages.
  3. Delete all files in that branch. So that git knows that this is intentional, use the git rm command to do this.
  4. 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/)
    
  5. Commit and push your new file.

  6. On GitHub, enter your project’s Settings area. Select Pages.
    • Due to a policy change at GitHub, you will need to make your GitHub repository public.

    Under Source, select your gh-pages branch. Leave the folder at root.

    Click Save.
  7. 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.

  8. 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.

  1. Change back to your project’s main branch.
  2. Modify your build.gradle file to add a task named reports. The reports task should simply ensure that both the test and javadoc tasks have been executed.
  3. Modify your build.gradle file to add a task named deployReports. This task should
    • guarantee that the reports task has been run
    • copy the build/docs/ directory, and all its contents, to the docs/ directory in your gh-pages branch.
    • copy the build/reports/ directory, and all its contents, to the reports/ directory in your gh-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.)

  4. 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.

  5. Commit your changes to build.gradle, then push those and your gh-pages changes with

    git push --all
    

reports task should simply ensure that both the test and javadoc tasks have been executed.

  1. 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.