Skip to content

Commit 69ec606

Browse files
committed
Updates to testing from dry run
1 parent 911d120 commit 69ec606

File tree

6 files changed

+43
-34
lines changed

6 files changed

+43
-34
lines changed

content/guided-workshop/exercises/1-code-scanning.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ In this exercise, you enabled GitHub Advanced Security. You enabled Dependabot t
7979
### Additional resources
8080

8181
- [About GitHub Advanced Security](https://docs.github.com/en/get-started/learning-about-github/about-github-advanced-security)
82-
- [GitHub skills - Secure your repository's supply chain](https://github.com/skills/secure-repository-supply-chain)
83-
- [GitHub skills - Secure code game](https://github.com/skills/secure-code-game)
82+
- [GitHub Skills: Secure your repository's supply chain](https://github.com/skills/secure-repository-supply-chain)
83+
- [GitHub Skills: Secure code game](https://github.com/skills/secure-code-game)

content/guided-workshop/exercises/3-codespaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ Congratulations! You have now defined a custom development environment including
104104
- [GitHub Codespaces](https://github.com/features/codespaces)
105105
- [Getting started with GitHub Codespaces](https://docs.github.com/en/codespaces/overview)
106106
- [Defining dev containers](https://docs.github.com/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers)
107-
- [Code with Codespaces](https://github.com/skills/code-with-codespaces)
107+
- [GitHub Skills: Code with Codespaces](https://github.com/skills/code-with-codespaces)

content/guided-workshop/exercises/4-testing.md

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,24 @@ Let's create a workflow to implement testing.
5353
```yml
5454
name: End-to-end tests
5555
on:
56-
push:
57-
branches: ["main"]
58-
pull_request:
59-
branches: ["main"]
56+
push:
57+
branches: ["main"]
58+
pull_request:
59+
branches: ["main"]
6060
jobs:
61-
cypress-run:
62-
runs-on: ubuntu-20.04
63-
steps:
64-
- name: Checkout
65-
uses: actions/checkout@v3
66-
# Install NPM dependencies, cache them correctly
67-
# and run all Cypress tests
68-
- name: Cypress run
69-
uses: cypress-io/github-action@v5
70-
with:
71-
build: npm run build
72-
start: npm run start
73-
project: ./src
74-
env:
75-
MONGODB_URI: test
61+
cypress-run:
62+
runs-on: ubuntu-20.04
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v3
66+
- name: Cypress run
67+
uses: cypress-io/github-action@v5
68+
with:
69+
build: npm run build
70+
start: npm run start
71+
project: ./src
72+
env:
73+
MONGODB_URI: test
7674
```
7775

7876
> **IMPORTANT:** YML is sensitive to tab/space levels. Ensure the tabbing is as displayed above.
@@ -102,27 +100,29 @@ Next is [Cypress](https://github.com/marketplace/actions/cypress-io), which will
102100

103101
With the workflow created, let's push it to the repository. Typically you would create a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) for any new code (which this is). To streamline the process, we're going to push straight to main as we'll be exploring pull requests and the [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow) in a later exercise. You'll start by obtaining the number of the [issue you created earlier](./2-issues.md), creating a commit for the new code, then pushing it to main.
104102

105-
1. Open a terminal window in your codespace by pressing <kbd>Ctl</kbd> + <kbd>`</kbd>.
106-
1. List all issues for the repository by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
103+
> **NOTE:** All commands are entered using the terminal window in the codespace.
104+
105+
1. Use the open terminal window in your codespace, or open it (if necessary) by pressing <kbd>Ctl</kbd> + <kbd>`</kbd>.
106+
1. List all issues for the repository by entering the following command in the terminal window:
107107
108108
```bash
109109
gh issue list
110110
```
111111
112112
1. Note the issue number for the one titled **Implement testing**.
113-
1. Stage all files by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
113+
1. Stage all files by entering the following command in the terminal window:
114114
115115
```bash
116116
git add .
117117
```
118118
119-
1. Commit all changes with a message by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac), replacing **<ISSUE_NUMBER>** with the number for the **Implement testing** issue:
119+
1. Commit all changes with a message by entering the following command in the terminal window, replacing **<ISSUE_NUMBER>** with the number for the **Implement testing** issue:
120120
121121
```bash
122122
git commit -m "Resolves #<ISSUE_NUMBER>"
123123
```
124124
125-
1. Push all changes to the repository by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
125+
1. Push all changes to the repository by entering the following command in the terminal window:
126126
127127
```bash
128128
git push
@@ -138,13 +138,24 @@ Pushing the workflow definition to the repository counts as a push to `main`, me
138138
139139
1. Return to your repository.
140140
1. Select the **Actions** tab.
141-
1. Select the name of the action on the left side.
142-
1. Note the test running (and eventually failing). You can click the name of the action to see the individual steps, and the logs provided by those steps.
141+
1. Select **End-to-end tests** on the left side.
142+
1. Note the tests running on the right side with a message of **Resolves <ISSUE_NUMBER>**, matching the commit message you used (and eventually failing).
143143
144-
## Summary and next steps
144+
![Screenshot of the workflow running](./images/4-workflow-run.png)
145145
146-
Implementing continuous integration and continuous deployment is critical to successful DevOps. Automating these processes ensures consistency and reduces the workload required for developers and administrators. You have created a workflow to run tests on any new code for your codebase.
146+
1. When the test fails, select the name of the run (which should be similar to **Resolves <ISSUE_NUMBER>**). You will see the results of the test, which will be similar to the screenshot below:
147147
148-
Let's turn our attention to [adding code to our project](./5-coding.md).
148+
![Screenshot of results](./images/4-workflow-run.png)
149+
150+
You've now seen a workflow, and explore the details of a run!
151+
152+
## Summary and next steps
153+
154+
Congratulations! You've implemented automated testing, a standard part of continuous integration, which is critical to successful DevOps. Automating these processes ensures consistency and reduces the workload required for developers and administrators. You have created a workflow to run tests on any new code for your codebase. Let's turn our attention to [adding code to our project](./5-coding.md).
149155
150156
### Resources
157+
158+
- [GitHub Actions](https://github.com/features/actions)
159+
- [GitHub Actions Marketplace](https://github.com/marketplace?type=actions)
160+
- [About continuous integration](https://docs.github.com/en/actions/automating-builds-and-tests/about-continuous-integration)
161+
- [GitHub Skills: Test with Actions](https://github.com/skills/test-with-actions)

content/guided-workshop/exercises/7-create-environment.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ Let's create variables for the name of the resource group and your prefix:
114114

115115
You've now configured Azure and added secrets & variables to your repository. You're now ready to create the workflow! This workflow will run on-demand, and create the resources on Azure. This will both make it easier to create everything and ensure it's done correctly.
116116
117-
Previously you created a workflow by using the **Actions** tab in your repository. While this works, it's not always ideal as you will often want better support from your editor. Since workflows are defined as [YML](https://en.wikipedia.org/wiki/YAML) files
118-
119117
1. Return to your codespace.
120118
1. If the **Terminal** window isn't already open, open it by pressing <kbd>Ctl</kbd> - <kbd>`</kbd> on your keyboard.
121119
1. Switch to the `main` branch, pull any changes currently on the server to your codespace, and create a new branch by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
77.6 KB
Loading
51.1 KB
Loading

0 commit comments

Comments
 (0)