Matrix Build Strategy
Spotify ☯️ Medium CI/CD
Beginner Mode

Start your terminal to use beginner mode.

Objective

A repository at /home/interview/repo contains a Node.js application with a test suite that needs to be tested across multiple Node.js versions (18, 20, and 22). The repository has the upload-artifact action available locally at .github/actions/upload-artifact.

Task

Complete the workflow at .github/workflows/pr-tests.yml that runs the test suite across Node.js versions 18, 20, and 22 using a matrix strategy with container images (node:${{ matrix.node-version }}-slim). Each matrix job should create a node-version.txt file containing its Node.js version number and upload it as an artifact named node-<version>-version (e.g., node-18-version) using the local upload-artifact action. The workflow should trigger on pull requests.

File Path

  • Workflow: /home/interview/repo/.github/workflows/pr-tests.yml
  • Test suite: /home/interview/repo/run-tests.sh

Terminal requires a larger screen

Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.

Linux Terminal Environment

Write and execute your solution in the terminal below.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →