Skip to content

Commit 8daf749

Browse files
GeekTrainerCopilot
andcommitted
Restructure GitHub Actions workshop modules
- Add module 0 (setup) for creating repo from template - Rewrite module 1 (intro) as hello world workflow_dispatch - Add module 2 (running tests) with unit + e2e tests in parallel - Add module 3 (caching) for pip/npm with marketplace intro - Update module 4 (matrix) to Python 3.12/3.13/3.14 only - Rewrite module 5 (deploy) to use custom azd pipeline definition - Introduce GITHUB_TOKEN and permissions in module 2 - Replace pytest with unittest across all modules - Update default Python version to 3.14 - Centralize shared setup images to content/images/ - Renumber all modules 0-8 with updated cross-references Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 02c14c5 commit 8daf749

16 files changed

Lines changed: 622 additions & 525 deletions

content/1-hour/0-setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ Let's create the repository you'll use for your workshop.
1717
1. Navigate to [the repository root](/)
1818
2. Select **Use this template** > **Create a new repository**
1919

20-
![Screenshot of Use this template dropdown](images/0-setup-template.png)
20+
![Screenshot of Use this template dropdown](../images/setup-use-template.png)
2121

2222
3. Under **Owner**, select the name of your GitHub handle, or the owner specified by your workshop leader.
2323
4. Under **Repository**, set the name to **pets-workshop**, or the name specified by your workshop leader.
2424
5. Ensure **Public** is selected for the visibility, or the value indicated by your workshop leader.
2525
6. Select **Create repository from template**.
2626

27-
![Screenshot of configured template creation dialog](images/0-setup-configure.png)
27+
![Screenshot of configured template creation dialog](../images/setup-configure-repo.png)
2828

2929
In a few moments a new repository will be created from the template for this workshop!
3030

content/full-day/0-setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ Let's create the repository you'll use for your workshop.
1212

1313
1. Navigate to [the repository root][repo-root]
1414
2. Select **Use this template** > **Create a new repository**
15-
![Screenshot of Use this template dropdown](../1-hour/images/0-setup-template.png)
15+
![Screenshot of Use this template dropdown](../images/setup-use-template.png)
1616
3. Under **Owner**, select the name of your GitHub handle, or the owner specified by your workshop leader.
1717
4. Under **Repository**, set the name to **pets-workshop**, or the name specified by your workshop leader.
1818
5. Ensure **Public** is selected for the visibility, or the value indicated by your workshop leader.
1919
6. Select **Create repository from template**.
20-
![Screenshot of configured template creation dialog](../1-hour/images/0-setup-configure.png)
20+
![Screenshot of configured template creation dialog](../images/setup-configure-repo.png)
2121

2222
In a few moments a new repository will be created from the template for this workshop!
2323

content/github-actions/0-introduction.md

Lines changed: 0 additions & 170 deletions
This file was deleted.

content/github-actions/0-setup.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Workshop Setup
2+
3+
| [← GitHub Actions: From CI to CD][walkthrough-previous] | [Next: Introduction & Your First Workflow →][walkthrough-next] |
4+
|:-----------------------------------|------------------------------------------:|
5+
6+
To complete this workshop you will need to create a repository with a copy of the contents of this repository. While this can be done by [forking a repository][fork-repo], the goal of a fork is to eventually merge code back into the original (or upstream) source. In our case we want a separate copy as we don't intend to merge our changes. This is accomplished through the use of a [template repository][template-repo]. Template repositories are a great way to provide starters for your organization, ensuring consistency across projects.
7+
8+
The repository for this workshop is configured as a template, so we can use it to create your repository.
9+
10+
## Create your repository
11+
12+
Let's create the repository you'll use for your workshop.
13+
14+
1. Navigate to [the repository root][repo-root]
15+
2. Select **Use this template** > **Create a new repository**
16+
17+
![Screenshot of Use this template dropdown](../images/setup-use-template.png)
18+
19+
3. Under **Owner**, select the name of your GitHub handle, or the owner specified by your workshop leader.
20+
4. Under **Repository**, set the name to **pets-workshop**, or the name specified by your workshop leader.
21+
5. Ensure **Public** is selected for the visibility, or the value indicated by your workshop leader.
22+
6. Select **Create repository from template**.
23+
24+
![Screenshot of configured template creation dialog](../images/setup-configure-repo.png)
25+
26+
In a few moments a new repository will be created from the template for this workshop!
27+
28+
## Summary and next steps
29+
30+
You've now created the repository you'll use for this workshop! Next let's [create your first workflow][walkthrough-next].
31+
32+
| [← GitHub Actions: From CI to CD][walkthrough-previous] | [Next: Introduction & Your First Workflow →][walkthrough-next] |
33+
|:-----------------------------------|------------------------------------------:|
34+
35+
[fork-repo]: https://docs.github.com/en/get-started/quickstart/fork-a-repo
36+
[template-repo]: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository
37+
[repo-root]: /
38+
[walkthrough-previous]: README.md
39+
[walkthrough-next]: 1-introduction.md
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Introduction & Your First Workflow
2+
3+
| [← Workshop Setup][walkthrough-previous] | [Next: Running Tests →][walkthrough-next] |
4+
|:-----------------------------------|------------------------------------------:|
5+
6+
[GitHub Actions][github-actions] is an automation platform built into GitHub that lets you build, test, and deploy your code directly from your repository. While it's most commonly used for CI/CD, it can automate just about any task in your development workflow — from labeling issues to resizing images.
7+
8+
Before diving in, here are the key terms you'll encounter:
9+
10+
- **Workflow**: An automated process defined in a YAML file, stored in `.github/workflows/`.
11+
- **Event**: A trigger that starts a workflow, such as a `push`, `pull_request`, or `workflow_dispatch`.
12+
- **Job**: A set of steps that run on the same runner. Jobs run in parallel by default.
13+
- **Step**: An individual task within a job — either a shell command (`run`) or a reusable action (`uses`).
14+
- **Runner**: The virtual machine that executes your jobs (e.g., `ubuntu-latest`).
15+
- **Action**: A reusable unit of code that performs a specific task, published on the [Actions Marketplace][actions-marketplace].
16+
17+
## Scenario
18+
19+
The shelter has built its application — a Flask API and Astro frontend — and the team is ready to start automating their development workflow. Before diving into CI/CD, let's start with the basics: creating a simple workflow, triggering it manually, and understanding the logs.
20+
21+
## Understanding GitHub Actions
22+
23+
A workflow file is written in YAML and lives in the `.github/workflows/` directory. Here are the core sections you'll work with:
24+
25+
- `name`: A human-readable name for the workflow, displayed in the **Actions** tab.
26+
- `on`: Defines the events that trigger the workflow (e.g., `push`, `pull_request`, `workflow_dispatch`).
27+
- `jobs`: Contains one or more jobs, each with a unique identifier.
28+
- `runs-on`: Specifies the runner environment (e.g., `ubuntu-latest`).
29+
- `steps`: An ordered list of tasks the job performs.
30+
- `uses`: References a reusable action (e.g., `actions/checkout@v4`).
31+
- `run`: Executes a shell command.
32+
33+
## Create your first workflow
34+
35+
Let's start with the classic "Hello World" — a workflow you can trigger manually from the GitHub UI.
36+
37+
1. In your repository, create the folder `.github/workflows/` if it doesn't already exist.
38+
2. Create a new file named `.github/workflows/hello.yml`.
39+
3. Add the following content:
40+
41+
```yaml
42+
name: Hello World
43+
44+
on:
45+
workflow_dispatch:
46+
47+
jobs:
48+
greet:
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- name: Say hello
53+
run: echo "Hello, GitHub Actions!"
54+
55+
- name: Show environment info
56+
run: |
57+
echo "Runner OS: $RUNNER_OS"
58+
echo "Repository: $GITHUB_REPOSITORY"
59+
echo "Triggered by: $GITHUB_ACTOR"
60+
```
61+
62+
4. Save the file.
63+
64+
> [!NOTE]
65+
> The `workflow_dispatch` event lets you trigger the workflow manually from the **Actions** tab. This is useful for testing workflows without needing to push code changes every time.
66+
67+
## Push and run
68+
69+
Now let's push the workflow and trigger it by hand.
70+
71+
1. Stage and commit your changes:
72+
73+
```bash
74+
git add .github/workflows/hello.yml
75+
git commit -m "Add hello world workflow"
76+
```
77+
78+
2. Push to your repository:
79+
80+
```bash
81+
git push
82+
```
83+
84+
3. Navigate to your repository on GitHub and select the **Actions** tab.
85+
4. In the left sidebar, select the **Hello World** workflow.
86+
5. Select the **Run workflow** button, keep the default branch, and select **Run workflow** again to confirm.
87+
88+
## Explore the logs
89+
90+
Once the run completes, let's explore what happened.
91+
92+
1. Select the workflow run that just completed.
93+
2. Select the **greet** job to expand it.
94+
3. Explore the logs for each step:
95+
- **Say hello** — you'll see the `echo` output.
96+
- **Show environment info** — notice the environment variables that GitHub Actions provides automatically (`RUNNER_OS`, `GITHUB_REPOSITORY`, `GITHUB_ACTOR`).
97+
4. Also look at the **Set up job** and **Complete job** steps that Actions adds automatically — these show the runner setup and cleanup.
98+
99+
> [!TIP]
100+
> You can search within the logs using the search box at the top of the log viewer, and expand or collapse individual steps. This becomes very useful as workflows grow more complex.
101+
102+
## Summary and next steps
103+
104+
Congratulations! You've created and run your first GitHub Actions workflow. You've learned how to define a workflow in YAML, trigger it manually with `workflow_dispatch`, and navigate the logs in the Actions UI.
105+
106+
Next, we'll put this knowledge to work by [building a CI workflow][walkthrough-next] that automatically tests the shelter's application.
107+
108+
### Resources
109+
110+
- [GitHub Actions documentation][github-actions-docs]
111+
- [Workflow syntax for GitHub Actions][workflow-syntax]
112+
- [Events that trigger workflows][workflow-triggers]
113+
- [Understanding GitHub Actions][understanding-actions]
114+
115+
| [← Workshop Setup][walkthrough-previous] | [Next: Running Tests →][walkthrough-next] |
116+
|:-----------------------------------|------------------------------------------:|
117+
118+
[actions-marketplace]: https://github.com/marketplace?type=actions
119+
[github-actions]: https://github.com/features/actions
120+
[github-actions-docs]: https://docs.github.com/en/actions
121+
[understanding-actions]: https://docs.github.com/en/actions/about-github-actions/understanding-github-actions
122+
[workflow-syntax]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
123+
[workflow-triggers]: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
124+
[walkthrough-previous]: 0-setup.md
125+
[walkthrough-next]: 2-running-tests.md

0 commit comments

Comments
 (0)