Test with Actions

Create workflows that enable you to use Continuous Integration (CI) for your projects.

Step 3: Upload test reports

The workflow has finished running! ✨

So what do we do when we need the work product of one job in another? We can use the built-in artifact storage to save artifacts created from one job to be used in another job within the same workflow.

To upload artifacts to the artifact storage, we can use an action built by GitHub: actions/upload-artifacts.

⌨️ Activity: Upload test reports

  1. Edit your workflow file.

  2. Update the Run markdown lint step in your build job to use vfile-reporter-json and output the results to remark-lint-report.json.

  3. Add a step to your build job that uses the upload-artifact action. This step should upload the remark-lint-report.json file generated by the updated Run markdown lint step.

  4. Your new build should look like this:

    build:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v4
    
        - name: Run markdown lint
          run: |
            npm install remark-cli remark-preset-lint-consistent vfile-reporter-json
            npx remark . --use remark-preset-lint-consistent --report vfile-reporter-json 2> remark-lint-report.json
    
        - uses: actions/upload-artifact@v3
          with:
            name: remark-lint-report
            path: remark-lint-report.json
  5. Commit your change to this branch.

  6. Wait about 20 seconds and then refresh this page (the one you're following instructions from). GitHub Actions will automatically update to the next step.

Like the upload action to send artifacts to the storage, you can use the download action to download these previously uploaded artifacts from the build job: actions/download-artifact. For brevity, we'll skip that step for this course.


Get help: Post in our discussion boardReview the GitHub status page

© 2023 GitHub • Code of ConductMIT License