跳到主要内容

Workflow, Jobs, Steps, and Actions

The execution model of AtomGit Action follows a clear hierarchical 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 and proceeds in order 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 a 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
jobs:
build-job:
runs-on: ubuntu-latest
steps:
- run: echo "Building..."

- test
jobs:
test-job:
runs-on: ubuntu-latest
steps:
- run: echo "Testing..."

- deploy
jobs:
deploy-job:
runs-on: ubuntu-latest
steps:
- run: echo "Deploying..."

Stages (Stages)

Stage is a unique orchestration mechanism in AtomGit Action:

  • Serial 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 start 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 post-processing stage is a special type of Stage in AtomGit Action:

  • Executed after the pipeline reaches its final state, with run_always: true by default.
  • Suitable for closing 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:

FieldDescription
stageDeclares the Stage to which the Job belongs
runs-onSpecifies the runner tag
needsDeclares dependencies on other Jobs
ifConditional expression
envJob-level environment variables
stepsList of steps, executed sequentially
timeout-minutesTimeout duration
continue-on-errorDoes not block subsequent steps if the Job fails
strategyMatrix strategy configuration

Step (Step)

A Step is the smallest execution unit within a Job, running sequentially according to the defined order:

TypeKeywordDescription
ScriptrunExecutes Shell commands
ActionusesCalls a reusable action component
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 official resource pool Runners and self-hosted Runners:

jobs:
build:
runs-on: ubuntu-latest # Official resource pool
deploy:
runs-on: [self-hosted, linux, x64] # Self-hosted