Workflows (CI/CD)

Generate CI & CI/CD workflows

The exasol-toolbox simplifies and supports 3 easily maintainable workflows. in order to make them work follow the description bellow.

Workflows:

  • CI

    Verifies PR’s and regularly checks the project.

  • CI/CD

    Verifies and publishes releases of the project.

  • PR-Merge

    Validates merges and updates the documentation.

0. Determine the toolbox version

One of the snippets bellow, should do the trick:

  1. poetry show exasol-toolbox
    
  2. python -c "from exasol.toolbox.version import VERSION;print(VERSION)"
    

1. Configure your project

Make sure your github project has access to a deployment token for PyPi with the following name: PYPI_TOKEN. It should be available to the repository either as Organization-, Repository- or Environment- secret.

2. Add the standard workflows to your project

tbx workflow install all

Warning

If you already have various workflows you may want to run the update instead of the install command.

CI Workflow

ci-workflow

To enable this workflow, add a file with the name ci.yml in your .github/workflows folder and add the following content:

name: CI

on:
  push:
    branches-ignore:
      - "github-pages/*"
      - "gh-pages/*"
      - "main"
      - "master"
  pull_request:
    types: [opened, reopened]
  schedule:
    # “At 00:00 on every 7th day-of-month from 1 through 31.” (https://crontab.guru)
    - cron: "0 0 1/7 * *"

jobs:

  ci-job:
    name: Checks
    uses: ./.github/workflows/checks.yml
    secrets: inherit

  metrics:
    needs: [ ci-job ]
    uses: ./.github/workflows/report.yml

CI/CD Workflow

Attention

Requires PYPI token to be available

ci-cd-workflow

To enable this workflow, add a file with the name ci-cd.yml in your .github/workflows folder and add the following content:

name: CI/CD

on:
  push:
    tags:
      - '**'

jobs:

  check-tag-version-job:
    name: Check Release Tag
    uses: ./.github/workflows/check-release-tag.yml

  ci-job:
    name: Checks
    needs: [ check-tag-version-job ]
    uses: ./.github/workflows/checks.yml
    secrets: inherit

  cd-job:
    name: Continuous Delivery
    needs: [ ci-job ]
    uses: ./.github/workflows/build-and-publish.yml
    secrets:
      PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

  metrics:
    needs: [ ci-job ]
    uses: ./.github/workflows/report.yml

PR-Merge Workflow

pr-merge-workflow

To enable this workflow, add a file with the name pr-merge.yml in your .github/workflows folder and add the following content:

name: PR-Merge

on:
  push:
    branches:
      - 'main'
      - 'master'

jobs:

  # This job can be removed if certain preconditions are met. See
  # https://exasol.github.io/python-toolbox/user_guide/workflows.html#pr-merge-workflow

  ci-job:
    name: Checks
    uses: ./.github/workflows/checks.yml
    secrets: inherit

  publish-docs:
    name: Publish Documentation
    uses: ./.github/workflows/gh-pages.yml

  metrics:
    needs: [ ci-job ]
    uses: ./.github/workflows/report.yml

In order to make merging to the main branch faster you can skip running the tests again in this workflow.

Before removing the ci-job from the workflow by please make sure the following prerequisites are met, as in some circumstances these tests might be the last or even only chance to detect problems.

  • GitHub branch protection for main branch is properly configured.

  • All dependencies are pointing to proper pypi packages in specific versions, i.e. no dependencies to the main branch of other git repositories.

  • Development branches are short-lived and merged to main branch soon after finishing tests in the context of a pull request.