Skip to main content
This guide demonstrates how to add a GitHub Actions job that uploads unit test and code coverage reports to an Amazon S3 bucket. You can place this reporting job anywhere in your workflow by adjusting the needs dependencies. In this example, we insert it after the code coverage job.

Workflow Configuration

First, define any required environment variables at the top of your workflow:

reports-s3 Job

Add the following reports-s3 job to download artifacts, merge XML reports, and prepare for an S3 upload:
  • The needs: [code-coverage, unit-testing] directive ensures this job runs only after your unit tests and coverage jobs finish.
  • continue-on-error: true prevents build failures if uploads fail.
  • Use actions/download-artifact@v3 to fetch artifacts from previous jobs.

Step Summary


Example: Unit Testing Job

The following job runs unit tests and uploads the results as an artifact named Mocha-Test-Result.

Example: Code Coverage Job

This job executes your coverage script and archives the coverage directory:

After you push these changes, the GitHub Actions graph will display the AWS S3 - Upload Reports job dependent on both unit testing and code coverage.
The image shows a GitHub Actions workflow interface with a job titled "AWS S3 - Upload Reports" that has successfully completed. It includes steps like setting up the job, downloading artifacts, merging test files, and uploading to AWS S3.

Sample Merge Output

When this job runs, you’ll see output similar to:
This confirms your XML reports are consolidated under reports-${{ github.sha }}.

Next Steps

In the next guide, you’ll implement the actual Amazon S3 upload using AWS CLI or an official GitHub Action.

Watch Video