Workflow, Job, Step, and Action
This document introduces the core execution model of AtomGit Action, including the hierarchical structure and roles of Workflow, Stage, Job, Step, Action, and Runner.
The execution model of AtomGit Action follows a clear hierarchy chain:
Event → Workflow → Stages → Jobs → Runner → Steps → Scripts / Actions
After a specific Event (event) is triggered, the system loads the corresponding Workflow (workflow) definition file, proceeds in order by Stages (stages), and by default, all Jobs (jobs) within each Stage are executed in parallel. Each Job is assigned to a Runner (runner), and the Steps (steps) within the Job are executed sequentially.
Workflow (Workflow)
A Workflow is the top-level definition of an automated process, stored in the .gitcode/workflows/ directory of the repository, described in YAML format.
name: Build and Deploy
on:
push:
branches: [main]
stages:
build:
name: Build
jobs:
build-job:
name: Build Job
runs-on: ubuntu-latest
steps:
- name: Run build
run: echo "Building..."
test:
name: Test
jobs:
test-job:
name: Test Job
runs-on: ubuntu-latest
steps:
- name: Run test
run: echo "Testing..."
deploy:
name: Deploy
jobs:
deploy-job:
name: Deploy Job
runs-on: ubuntu-latest
steps:
- name: Run deploy
run: echo "Deploying..."
Stages (Stages)
Stage is a unique orchestration mechanism of AtomGit Action:
- Sequential execution between stages: The next stage starts only after all jobs in the previous stage are completed.
- Default parallel execution within a stage: Multiple jobs in the same stage are started simultaneously by default.
- fail_fast mechanism: When a stage sets
fail_fast: true, any job failure immediately terminates other jobs in the same stage.
stages:
build_stage:
name: Build
fail_fast: true
jobs:
runs-on:
...
test_stage:
name: Test
jobs:
runs-on:
...
The Post-processing stage is a special type of Stage in AtomGit Action.
- Executed after the pipeline reaches a terminal state
- Suitable for end-of-pipeline operations such as notifications, cleanup, and reporting
Job (Job)
A Job is an executable unit within a Stage, scheduled to run on a Runner. Core attributes:
| Field | Description |
|---|---|
stage | Declares the Stage to which the Job belongs |
runs-on | Specifies the runner tag |
needs | Declares dependencies on other Jobs |
if | Conditional expression |
env | Job-level environment variables |
steps | List of steps, executed sequentially |
timeout-minutes | Timeout duration |
continue-on-error | Does not block subsequent steps if the Job fails |
strategy | Matrix strategy configuration |
Step (Step)
A Step is the smallest execution unit within a Job, running sequentially in the defined order:
| Type | Keyword | Description |
|---|---|---|
| Script | run | Execute Shell commands |
| Action | uses | Call reusable action components |
steps:
- name: Checkout code
uses: checkout
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
env:
NODE_ENV: test
Action (Action)
An Action is a reusable atomic operation component, called by a Step through the uses field:
steps:
- uses: checkout
- uses: setup-node
with:
node-version: '20'