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:
Event → Workflow → Stages → Jobs → Runner → Steps → Scripts / Actions
After a specific Event (event) is triggered, the system loads the corresponding Workflow (workflow) definition file and proceeds sequentially by Stages (stages). Within each Stage, Jobs (jobs) are executed in parallel by default. 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 automation 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-llatest
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 in AtomGit Action:
- Sequential execution between stages: The next stage starts only after all jobs in the previous stage are completed.
- 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 stops 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 its final state.
- Suitable for closing operations such as notifications, cleanup, and reporting.
Limitation: Currently, a maximum of 16 stages are supported.
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 the Job belongs to |
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 | Executes Shell commands |
| Action | uses | Calls 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'
Runner (Runner)
A Runner is a computing node that executes Jobs, divided into AtomGit managed resource pools and self-hosted Runners:
jobs:
build:
name: Build
runs-on: ubuntu-latest # AtomGit managed resource pool
deploy:
name: Deploy
runs-on: [self-hosted, linux, x64] # Self-hosted