Week 12

Spring profiles

CI/CD Concepts

GitHub Actions

Docker in CI

Deploying from a Pipeline

Quality Gates

Practice

Assignment

Backend Track

Let’s get practical

Short, self-study exercises — each takes minutes to an hour. Exercises 2–4 are hands-on; keep the Actions tab open.

Exercise 1 — Spot the bugs (no computer needed)

A teammate wrote this workflow. It contains three mistakes. Find them by reading only — then check yourself.

name: CI

on:
  pull-request:

jobs:
  test:
    runs-on: ubuntu latest
    steps:
      - uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: '25'
      - name: Run tests
        run: mvn --batch-mode verify

Exercise 2 — Hello, runner

Meet the machine your pipelines run on.

<aside> ⌨️

Hands on: create a new empty repository (this is a sandbox — not your project). Add .github/workflows/hello.yaml that triggers on: push and runs these steps, then push and read the log of each step:

</aside>

- name: Who and where am I?
  run: |
    whoami
    pwd
    ls -la
- uses: actions/checkout@v4
- name: And now?
  run: ls -la
- name: What is in the environment?
  run: printenv | sort | head -30

Notice: before checkout the folder is empty; after checkout your repository appears; and the environment contains GitHub's variables — none of yours. You are on a stranger's fresh computer, and now you have seen it with your own eyes.

Exercise 3 — Feel the cache

In your project's workflow, temporarily remove the cache: maven line, push, and note the duration of the Run tests step in the run summary. Put the line back, push again twice, and compare the durations of the second and third runs.

Exercise 4 — Break the gate (on purpose)

This only works after you set up branch protection from the GitHub Actions chapter.

<aside> ⌨️

Hands on: on a new branch, change one assertion in a test so it fails. Push, open a pull request, and watch: the check turns red and the merge button is disabled. Read the CI log and find which test failed and why — practise the four-step reading routine. Then fix the test, push, and watch the button come back.

</aside>

<aside> 🎉

You have now seen the gate catch a real (well, staged) bug before it reached main. That moment — red check, disabled button — is CI doing its job.

</aside>


The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0 *https://hackyourfuture.net/*

CC BY-NC-SA 4.0 Icons

Built with ❤️ by the HackYourFuture community · Thank you, contributors

Found a mistake or have a suggestion? Let us know in the feedback form.