Sign inSign up free

602. Test Across Versions with a Matrix

medium 20 XP ~8 minHands-on lab

/home/student/repos/webapp/.github/workflows/test.yml has three copy-pasted jobs that test on Node 18, 20 and 22, all on Linux. The library now also supports Windows, except on Node 18.

Task

Replace the three jobs with one job named test that uses a matrix:

  • node: 18, 20, 22
  • os: ubuntu-latest, windows-latest
  • exclude the windows-latest + 18 combination (5 jobs in total)
  • a failure in one combination must not cancel the others
  • the job runs on matrix.os, and actions/setup-node gets node-version from matrix.node
  • keep the steps: checkout, setup-node, npm ci, npm test

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of CI/CD Pipelines in Practice. Next step: Handing the Build to the Deploy Job

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.