CI/CD Pipelines

Used Stacks

  1. Jenkins (Black, flake8, Pylint, Setuptools, PyTest, Sphinx)

  2. GitHub Actions

Jenkins

CI/CD

Stage

Condition

1. Setup

⭕ [* Push]

2. Merge From Docs

⭕ [* Push] “Merge pull request*/docs”
⭕ [* Push] “Merge pull request*[Docs] Build by Sphinx for GitHub Pages”

3. 1. Lint

⭕ [dev* Push]
⭕ [master PR] (Except “Merge pull request*/docs” && “Merge pull request*[Docs] Build by Sphinx for GitHub Pages”)

4. 2. Build

⭕ [master Push] (Except “Merge pull request*/chore*”)
⭕ [dev* Push]
⭕ [master PR] (Except “Merge pull request*/docs” && “Merge pull request*[Docs] Build by Sphinx for GitHub Pages”)

5. 3. Test

⭕ [dev* Push]
⭕ [master PR] (Except “Merge pull request*/docs” && “Merge pull request*[Docs] Build by Sphinx for GitHub Pages”)

6. 4. Docs

⭕ [master PR] (Except “Merge pull request*/docs” && “Merge pull request*[Docs] Build by Sphinx for GitHub Pages”)

7. Deploy

⭕ [master Push] “Merge pull request*from Zerohertz/dev*” (Except “*from Zerohertz/chore*”)

Dev Branch

Branch Rule

The dev branch is used when there are functional changes resulting in different build outcomes.

dev-branch

  1. dev-* push

    1. Setup: Commit message parsing

    2. 1. Lint: Check format of python codes

    3. 2. Build: Install dependencies & build package

    4. 3. Test: Do PyTest

  2. dev-*master

    1. Setup: Commit message parsing

    2. 1. Lint: Check format of python codes

    3. 2. Build: Install dependencies & build package

    4. 3. Test: Do PyTest

    5. 4. Docs: Create PR (docsdev-*) including the build results generated by Sphinx

    6. Merge From Docs: If merge PR from docs, can merge dev-*master

  3. master push

    1. Setup: Commit message parsing

    2. 2. Build: Install dependencies & build package

    3. Deploy

      1. GitHub: Deploy to GitHub

      2. PyPI: Deploy to PyPI

Chore Branch

Branch Rule

The chore branch is utilized when the build result is not different, but there are changes in the CI/CD pipeline or documentation.

chore-branch

  1. chore-* push

    1. Setup: Commit message parsing

  2. chore-*master

    1. Setup: Commit message parsing

    2. 1. Lint: Check format of python codes

    3. 2. Build: Install dependencies & build package

    4. 3. Test: Do PyTest

    5. 4. Docs: Create PR (docschore-*) including the build results generated by Sphinx

    6. Merge From Docs: If merge PR from docs, can merge chore-*master

  3. master push

    1. Setup: Commit message parsing

GitHub Actions

Managing Labels for Issues and Pull Requests in GitHub

  • Issue

    • assignees: ['Zerohertz']

    • contains(github.event.issue.title, '[Bug]')labels: ['fix']

    • contains(github.event.issue.title, '[Chore]')labels: ['chore']

    • contains(github.event.issue.title, '[Style]')labels: ['style']

    • contains(github.event.issue.title, '[Docs]')labels: ['docs']

  • Pull Request

    • assignees: ['Zerohertz']

    • body.includes('bug') || body.includes('fix') || body.includes('수정')labelsToAdd.push('fix')

    • body.includes('style')labelsToAdd.push('style')

    • baseBranch === 'master' && headBranch.startsWith('dev')

      • labelsToAdd.push('release')

      • (file.filename.startsWith('Jenkins') || file.filename.startsWith('.github/workflows'))labelsToAdd.push('chore')

      • (file.filename.startsWith('sphinx') && !file.filename.includes('release'))labelsToAdd.push('docs')

      • (file.filename.startsWith('zerohertzLib/{MODULE_NAME}/__init__') || body.includes('{MODULE_NAME}'))labelsToAdd.push('feat/{MODULE_NAME}')

    • baseBranch === 'master' && headBranch.startsWith('chore')

      • labelsToAdd.push('release/chore')

      • (file.filename.startsWith('Jenkins') || file.filename.startsWith('.github/workflows'))labelsToAdd.push('chore')

      • (file.filename.startsWith('sphinx') && !file.filename.includes('release'))labelsToAdd.push('docs')

    • baseBranch.startsWith('dev') || baseBranch.startsWith('chore')) && headBranch === 'docs'

      • labelsToAdd.push('docs')

Sphinx Documentation Deployment

Sphinx Documentation

Documents created and built using Sphinx are deployed via GitHub Actions and GitHub Pages

pages-build-and-deployment