Skip to main content
Expanding a basic CI/CD pipeline into dedicated build, test, and deploy jobs improves clarity and parallelism in your GitHub Actions workflow.

Single-Job Workflow (Reference)

For comparison, here’s a simple workflow that runs an ASCII script in one job:

Multi-Job Workflow: Build, Test, and Deploy

Below is the enhanced workflow defining three independent jobs: build_job_1, test_job_2, and deploy_job_3.
By default, each job executes on a clean runner and does not share files. Use artifact actions or define dependencies to pass data between jobs.

Job Overview

Understanding Each Job

build_job_1

  • Runner: Ubuntu latest
  • Actions:
    1. Installs the cowsay utility
    2. Generates ASCII art into dragon.txt
    3. Simulates build time with sleep 30

test_job_2

  • Runner: Ubuntu latest
  • Actions:
    1. Waits 10 seconds
    2. Uses grep to ensure dragon.txt contains “dragon”
    3. Fails if the file is missing or the content isn’t found

deploy_job_3

  • Runner: Ubuntu latest
  • Actions:
    1. Outputs the content of dragon.txt
    2. Simulates deployment via echo "Deploying..."

Execution Behavior and Common Pitfalls

When you commit and push this workflow (e.g., git commit -m "Add multi-job workflow"), GitHub Actions triggers all jobs in parallel:
Each job runs in isolation on its own VM. Without artifacts or explicit job dependencies, files like dragon.txt won’t persist across jobs.
The image shows a GitHub Actions workflow summary with three jobs: "build_job_1" succeeded, while "test_job_2" and "deploy_job_3" failed, resulting in an overall failure status.
Since test_job_2 may start before build_job_1 finishes, any attempt to read dragon.txt will trigger a file-not-found error.
The image shows a GitHub Actions interface with a workflow run summary. It displays the status of multiple jobs, including "build_job_1" which succeeded, and "test_job_2" and "deploy_job_3" which failed.
Example error from test_job_2:
And from deploy_job_3:

Summary of Issues

  1. Parallel execution without defined dependencies
  2. Isolated environments prevent file sharing
We will address these issues by defining job dependencies and sharing artifacts between jobs.

Watch Video