You've joined the Monster Market's team. Their shop lives in ~/shop, with its tests in ./test.sh, and nothing runs them unless someone remembers to.
Continuous integration (CI) means everyone pushes small changes to the shared repository often, and a machine builds and tests each one. On GitHub, you describe that in a workflow: a YAML file in .github/workflows/.
name: CI # ← what GitHub calls it
on: push # ← when it runs: every push
jobs:
hello: # ← a job, named by you
runs-on: ubuntu-latest # ← the machine it gets
steps: # ← what it does, in order
- run: echo "Hello from CI"Indent with spaces, never tabs: GitHub rejects a file it can't read, and that run fails at once.
-
Make the folder and write the file (
.githubstarts with a dot):bashmkdir -p .github/workflowsbashnano .github/workflows/ci.yml -
Commit it and push it like any other file:
bashgit add .github && git commit -m "Add CI" && git push
GitHub reads the workflow from the commit you pushed and runs it. On github.com, runs are in the repository's Actions tab; the next lesson shows them in the terminal.
Objectives
- Push a workflow.
- Get a passing run.