-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for merge gate in CI workflow (#250)
--------- Co-authored-by: Christoph Kuhnke <[email protected]>
- Loading branch information
Showing
18 changed files
with
204 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Merge-Gate | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
ALTERNATIVE_GITHUB_TOKEN: | ||
required: false | ||
|
||
jobs: | ||
|
||
fast-checks: | ||
name: Fast | ||
uses: ./.github/workflows/checks.yml | ||
|
||
slow-checks: | ||
name: Slow | ||
runs-on: ubuntu-latest | ||
|
||
# Even though the environment "manual-approval" will be created automatically, | ||
# it still needs to be configured to require interactive review. | ||
# See project settings on GitHub (Settings / Environments / manual-approval). | ||
environment: manual-approval | ||
|
||
# Replace the steps below with the required actions | ||
# and/or add additional jobs if required | ||
# Note: | ||
# If you add additional jobs, make sure they are added as a requirement | ||
# to the approve-merge job's input requirements (needs). | ||
steps: | ||
- name: Tests | ||
run: | | ||
echo "Slow tests ran successfully" | ||
# This job ensures inputs have been executed successfully. | ||
approve-merge: | ||
name: Allow Merge | ||
runs-on: ubuntu-latest | ||
# If you need additional jobs to be part of the merge gate, add them below | ||
needs: [ fast-checks, slow-checks ] | ||
|
||
# Each job requires a step, so we added this dummy step. | ||
steps: | ||
- name: Approve | ||
run: | | ||
echo "Merge Approved" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +1,45 @@ | ||
Workflows (CI/CD) | ||
================= | ||
Github Workflows | ||
================ | ||
|
||
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. | ||
The exasol-toolbox ships with various GitHub workflows. By default, we suggest installing all of them, | ||
while the core workflows are: | ||
|
||
**Workflows**: | ||
|
||
* CI | ||
Verifies PR's and regularly checks the project. | ||
Verifies PRs and regularly checks the project. | ||
|
||
* CI/CD | ||
Verifies and publishes releases of the project. | ||
* CD | ||
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: | ||
|
||
#. | ||
Validates merges and updates the documentation. | ||
|
||
.. code-block:: shell | ||
|
||
poetry show exasol-toolbox | ||
The toolbox command itself, :code:`tbx`, provides various CLI functions to help you maintain those workflows. | ||
For further help, run the command :code:`tbx workflow --help`. | ||
|
||
#. | ||
|
||
.. code-block:: python | ||
1. Configure your project | ||
+++++++++++++++++++++++++ | ||
|
||
python -c "from exasol.toolbox.version import VERSION;print(VERSION)" | ||
* 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 an Organization-, Repository-, or Environment-secret. | ||
|
||
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. | ||
* If your CI workflow involves slow or expensive steps you can guard these to be executed only after manual approval. The CI workflow will automaticall create a GitHub environment named :code:`manual-approval`. You only need to add reviewers in (:code:`Settings/Environments/manual-approval`) and move the steps to be guarded into the related section in job :code:`slow-checks` in file :code:`.github/workflows/merge-gate.yml`. | ||
|
||
2. Add the standard workflows to your project | ||
+++++++++++++++++++++++++++++++++++++++++++++ | ||
2. Add all workflows to your project | ||
++++++++++++++++++++++++++++++++++++ | ||
|
||
.. code-block:: shell | ||
tbx workflow install all | ||
.. warning:: | ||
|
||
If you already have various workflows you may want to run the | ||
:code:`update` instead of the :code:`install` command. | ||
|
||
CI Workflow | ||
___________ | ||
|
||
.. figure:: ../_static/ci-workflow.png | ||
:alt: ci-workflow | ||
|
||
To enable this workflow, add a file with the name *ci.yml* in your *.github/workflows* folder | ||
and add the following content: | ||
|
||
.. literalinclude:: ../../exasol/toolbox/templates/github/workflows/ci.yml | ||
:language: yaml | ||
|
||
CI/CD Workflow | ||
______________ | ||
|
||
.. attention:: | ||
|
||
Requires PYPI token to be available | ||
|
||
.. figure:: ../_static/ci-cd-workflow.png | ||
:alt: 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: | ||
|
||
.. literalinclude:: ../../exasol/toolbox/templates/github/workflows/ci-cd.yml | ||
:language: yaml | ||
|
||
PR-Merge Workflow | ||
_________________ | ||
|
||
.. figure:: ../_static/pr-merge-workflow.png | ||
:alt: 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: | ||
|
||
.. literalinclude:: ../../exasol/toolbox/templates/github/workflows/pr-merge.yml | ||
:language: yaml | ||
#. If you already have various workflows, you may want to run the :code:`update` command instead of the :code:`install` command. | ||
|
||
In order to make merging to the main branch faster you can skip running the | ||
tests again in this workflow. | ||
#. Some workflows depend on other workflows. Please ensure you have all the required workflows if you do not install all of them. | ||
|
||
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. | ||
3. Update Branch Protection | ||
++++++++++++++++++++++++++++ | ||
|
||
* 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. | ||
The best and most maintainable way to have solid branch protection (:code:`Settings/Branches/main`) is to require the workflow :code:`CI / Allow Merge` to pass successfully. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.