diff --git a/.github/steps/-step.txt b/.github/steps/-step.txt index 0cfbf08..00750ed 100644 --- a/.github/steps/-step.txt +++ b/.github/steps/-step.txt @@ -1 +1 @@ -2 +3 diff --git a/README.md b/README.md index 0c5dc71..9acb46b 100644 --- a/README.md +++ b/README.md @@ -14,44 +14,48 @@ _Create workflows that enable you to use Continuous Integration (CI) for your pr -## Step 2: Fix the test +## Step 3: Upload test reports -_Great job adding the templated workflow! :tada:_ +_The workflow has finished running! :sparkles:_ -Adding that file to this branch is enough for GitHub Actions to begin running CI on your repository. +So what do we do when we need the work product of one job in another? We can use the built-in [artifact storage](https://docs.github.com/actions/advanced-guides/storing-workflow-data-as-artifacts) to save artifacts created from one job to be used in another job within the same workflow. -When a GitHub Actions workflow is running, you should see some checks in progress, like the screenshot below. +To upload artifacts to the artifact storage, we can use an action built by GitHub: [`actions/upload-artifacts`](https://github.com/actions/upload-artifact). -checks in progress in a merge box +### :keyboard: Activity: Upload test reports -You can follow along as GitHub Actions runs your job by going to the **Actions** tab or by clicking "Details" in the merge box below. +1. Edit your workflow file. +1. Update the `Run markdown lint` step in your `build` job to use `vfile-reporter-json` and output the results to `remark-lint-report.json`. +1. 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. +1. Your new `build` should look like this: -When the tests finish, you'll see a red X :x: or a green check mark :heavy_check_mark: in the merge box. At that point, you can access the logs for the build job and its associated steps. + ```yml + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 -_By looking at the logs, can you identify which tests failed?_ To find it, go to one of the failed builds and scroll through the log. Look for a section that lists all the unit tests. We're looking for the name of the test with an "x". + - 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 -screenshot of a sample build log with the names of the tests blurred out + - uses: actions/upload-artifact@v3 + with: + name: remark-lint-report + path: remark-lint-report.json + ``` -If the checks don't appear or if the checks are stuck in progress, there's a few things you can do to try and trigger them: - -- Refresh the page, it's possible the workflow ran and the page just hasn't been updated with that change. -- Try making a commit on this branch. Our workflow is triggered with a `push` event, and committing to this branch will result in a new `push`. -- Edit the workflow file on GitHub and ensure there are no red lines indicating a syntax problem. - -### :keyboard: Activity: Fix the test - -1. Update the code in the `ci` branch to get the test to pass. You need to look something like this: - ```markdown - _underscore_ - ``` -1. **Commit changes**. +1. Commit your change to this branch. 1. Wait about 20 seconds and then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/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`](https://github.com/actions/download-artifact). For brevity, we'll skip that step for this course. +