GitHub Actions part 3: matrix runs, caching and secrets used safely
Run the same tests in several browsers at once, save install time with a cache, and pass a password to a test without ever writing it in the file.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a repair shop with parts bins and a key box. The same repair is done on two bikes at the same time. A bin of ready parts saves a trip to the supplier. The shop keys stay in a locked box, never written on the job card.
The two bikes are the matrix. The bin is the cache. The locked box is the secret.
Leo, a developer at Daily List, a to-do list app, uses all three. Tom wants the same tests in Chrome and Firefox.
What it is: This slice of GitHub Actions runs one job many times, saves installs and hides passwords. A is one job per value, such as each browser. A restores installed packages, and a GitHub Actions secret is a stored value read as secrets.NAME. A single-browser job is the neighbour. It is simpler, and it misses the second browser.
Why it matters: One browser is not enough for Daily List. A cold install on every run burns minutes. A password written in the is copied into git history and into the log. The matrix covers the browsers, the cache shortens the install and the secret keeps the test password out of the file.
PLAIN WORDS · 2 in this section
- github
- a web site that hosts code and runs checks
- workflow
- the steps a piece of work follows, start to finish
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB A bicycle repair shop with parts bins and a key box.
- Bikes
- Bin
- Box
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| Two bikes at once | The matrix run |
| A bin of ready parts | The dependency cache |
| The locked key box | The secret |
| A part list on the bin | The cache key |
WHERE THIS PICTURE STOPS
- Two bikes fit one bench, but a big matrix costs time.
- A bin can hold old parts, so the key must change with the list.
- A key box is locked, but a printed secret is open to all.
HOOK
Two bikes, a bin, a locked box.
TELL A FRIEND
Two bikes, a bin and a key box.
OFTEN MIXED UP WITH GitHub Actions part 2: test every pull request, test on a schedule, and keep the report. That topic starts runs on pull requests and saves a report. This one adds a matrix, a cache and secrets.
PRACTISE AND KEEP
Sources for this topic — 3 sources
- Market practice
Running variations of jobs in a workflow (GitHub Docs) ↗ — GitHub Docs · GitHub Docs matrix page: a matrix strategy makes one job for each combination of values, include adds combinations, exclude removes them, fail-fast cancels running jobs when one fails, max-parallel caps how many run at once, and a matrix can make at most 256 jobs
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Dependency caching reference and Using secrets in GitHub Actions (GitHub Docs) ↗ — GitHub Docs · GitHub Docs on caching and secrets: the cache action tries an exact key and then restore keys, a key can join the runner system with a hash of the package lock file, keys are capped at 512 characters, secrets are read through the secrets context and hidden in logs, and secrets are not passed to workflows from forks
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Using secrets in GitHub Actions ↗ — GitHub · Secret availability and redaction limits, forked pull request restrictions.
Actual primary documentation body read during the complete V30 domain analysis before implementation. Live documentation access-dated; no claim this version is installed in the learner environment. No artwork copied by this content change.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.