Skip to content

Commit

Permalink
Splitting Workflow Files, for make the workflows reuseable, from other
Browse files Browse the repository at this point in the history
github projects.
  • Loading branch information
nolte committed Dec 26, 2021
1 parent 3f56714 commit 11deb9e
Show file tree
Hide file tree
Showing 21 changed files with 277 additions and 109 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ root = true
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[{Makefile,go.mod,go.sum,.gitmodules}]
indent_style = tab
Expand Down
2 changes: 1 addition & 1 deletion .github/commons-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ branches:
required_status_checks:
strict: true
contexts:
- "Static CI Tests"
- "static / Static CI Tests"
restrictions: null
18 changes: 0 additions & 18 deletions .github/commons-stale.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .github/stale.yml

This file was deleted.

15 changes: 4 additions & 11 deletions .github/workflows/build-static-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
name: CI Static Tests

on:
push:

jobs:
static:
name: "Static CI Tests"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2.4.0

- uses: actions/setup-python@v2

- uses: pre-commit/action@v2.0.3
uses: nolte/gh-plumbing/.github/workflows/reuseable-pre-commit.yaml@feature/reusing-workflows
security:
uses: nolte/gh-plumbing/.github/workflows/reuseable-trivy.yaml@feature/reusing-workflows
17 changes: 4 additions & 13 deletions .github/workflows/release-cd-deliver-docs.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
name: Release Deliver Docs

on:
release:
types: [published]

jobs:
publish_docs:
name: "Publish the HTML Documentation"
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v2.4.0

# TODO add feature toogle for mkdocs and hugo
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@1.24
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nolte/gh-plumbing/.github/workflows/reuseable-mkdocs.yaml@feature/reusing-workflows
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
11 changes: 3 additions & 8 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
name: Release Drafter

on:
push:
branches:
- develop

jobs:
update_release_draft:
name: Update Release Draft
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nolte/gh-plumbing/.github/workflows/reuseable-release-drafter.yml@feature/reusing-workflows
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/reuseable-mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Deliver Docs

on:
workflow_call:
secrets:
token:
required: true

jobs:
publish_docs:
name: "Publish the HTML Documentation"
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v2.4.0

# TODO add feature toogle for mkdocs and hugo
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@1.24
env:
token: ${{ secrets.token }}
16 changes: 16 additions & 0 deletions .github/workflows/reuseable-pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI Static Tests

on:
workflow_call:

jobs:
static:
name: "Static CI Tests"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2.4.0

- uses: actions/setup-python@v2

- uses: pre-commit/action@v2.0.3
16 changes: 16 additions & 0 deletions .github/workflows/reuseable-release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
workflow_call:
secrets:
token:
required: true

jobs:
update_release_draft:
name: Update Release Draft
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.token }}
35 changes: 35 additions & 0 deletions .github/workflows/reuseable-stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Mark or close stale issues and PRs"

on:
workflow_call:
secrets:
token:
required: true

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
repo-token: ${{ secrets.token }}
# Staling issues and PR's
days-before-stale: 30
stale-issue-label: stale
stale-pr-label: stale
stale-issue-message: |
This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days
stale-pr-message: |
This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days
# Not stale if have this labels or part of milestone
exempt-issue-labels: bug,wip,on-hold
exempt-pr-labels: bug,wip,on-hold
exempt-all-milestones: true
# Close issue operations
# Label will be automatically removed if the issues are no longer closed nor locked.
days-before-close: 10
delete-branch: true
close-issue-message: This issue was automatically closed because of stale in 10 days
close-pr-message: This PR was automatically closed because of stale in 10 days
27 changes: 27 additions & 0 deletions .github/workflows/reuseable-trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Security Tests

on:
workflow_call:

jobs:
build:
name: Build
runs-on: ubuntu-18.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: 'trivy-results.sarif'
9 changes: 9 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
on:
schedule:
- cron: "0 0 * * *"

jobs:
stale:
uses: nolte/gh-plumbing/.github/workflows/reuseable-stale.yaml@feature/reusing-workflows
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
args: ['--markdown-linebreak-ext=md']
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python 3.7.1
python 3.8.5
55 changes: 48 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,58 @@
# Plumbing

Collection of common Configs for Project Management and CI/CD.
<!--intro-start-->
Used for deduplicate the CI/CD Boilerplate-Code. Like [Workflow](https://docs.github.com/en/actions) and [Github App](https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps) configurations.
<!--intro-end-->

probot | git | description
----------------------------------------------------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------
[settings](https://probot.github.io/apps/settings/) | [probot/settings](https://github.com/probot/settings) | Configure Github Projects by Source.
[stale](https://probot.github.io/apps/stale/) | [probot/stale](https://github.com/probot/stale) | Handle stale issues.
[release-drafter](https://probot.github.io/apps/release-drafter/) | [toolmantim/release-drafter](https://github.com/toolmantim/release-drafter) | Creates a Human Readable Release Change Log.
[boring-cyborg](https://probot.github.io/apps/boring-cyborg/) | [kaxil/boring-cyborg](https://github.com/kaxil/boring-cyborg) | Different util actions like, automatically label Pull Request
## Workflows

<!--td-workflows-start-->
| Workflow | description |
|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ```reuseable-mkdocs.yaml``` | Publish a [mkdocs](https://www.mkdocs.org/) based Documentation as [Github Page](https://pages.github.com/). |
| ```reuseable-pre-commit.yaml``` | call [pre-commit](https://pre-commit.com/) for executing a set of Static Tests. |
| ```reuseable-release-drafter.yml``` | Will be use [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) for updating the current "Draft" Release with a Changelog. |
| ```reuseable-trivy.yaml``` | Scan the GitRepo by using [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action). |
<!--td-workflows-end-->

## Probot Config

<!--probot-intro-start-->
Collection of common Configs for Project Management and CI/CD.
For Using in other Github Projects, having a reuseable set of Probot Config Repo, more informations at [probot.github.io](https://probot.github.io/docs/best-practices/#configuration).
<!--probot-intro-end-->

<!--td-probot-apps-start-->
| probot | git | description |
|-------------------------------------------------------------------|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| [boring-cyborg](https://probot.github.io/apps/boring-cyborg/) | [kaxil/boring-cyborg](https://github.com/kaxil/boring-cyborg) | Different util actions like, automatically label Pull Request |
| [release-drafter](https://probot.github.io/apps/release-drafter/) | [toolmantim/release-drafter](https://github.com/toolmantim/release-drafter) | Creates a Human Readable Release Change Log. |
| [renovate](https://github.com/apps/renovate) | | Using [renovate](https://www.whitesourcesoftware.com/free-developer-tools/renovate/) for keep dependencies in sync. |
| [settings](https://probot.github.io/apps/settings/) | [probot/settings](https://github.com/probot/settings) | Configure Github Projects by Source. |
<!--td-probot-apps-end-->

For More Inforation take a look to the GH Page, [gh-plumbing](http://nolte.github.io/gh-plumbing).

## Development

<!--development-intro-start-->
We use the [asdf](https://asdf-vm.com/) Packagemanager.


```sh
asdf install

virtualenv ~/.vens/development

source ~/.vens/development/bin/activate
pip install -r requirements-dev.txt

mkdocs serve -a localhost:8001
```

Open [localhost:8001](http://localhost:8001/) for take a look to the lastest documentation, created with [mkdocs](https://www.mkdocs.org/).
<!--development-intro-end-->

## Links

* [nolte/cookiecutter-gh-project](https://github.com/nolte/cookiecutter-gh-project) for templating.
51 changes: 12 additions & 39 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,15 @@
# Shared Probot Configs
# Shared Configs

For Using in other Github Projects use the Probot Repo Config, more informations at [probot.github.io](https://probot.github.io/docs/best-practices/#configuration).
{%
include-markdown "../README.md"
start="<!--intro-start-->"
end="<!--intro-end-->"
%}

Example:
## Development

```ỳaml
_extends: gh-plumbing:.github/commons-stale.yml
```

The Reuseable configurations are prefixed with ```.github/commons-*.yml```.


### Shared Configs

#### Project Settings

For Central Project Configuration we use the [settings](https://probot.github.io/apps/settings/) Github App.

This Applications will be handle:

* Default Branch Configuration
* Project Description, topic etc.
* Label Colors


##### Usage

```
_extends: gh-plumbing:.github/commons-settings.yml
repository:
name: cookiecutter-gh-project
description: Template for Create Github Workflows and Projects
homepage: https://nolte.github.io/cookiecutter-gh-project
topics: templating, cookiecutter, github
```

#### Labelling

For Handle PR and Issue Labels we use a combination of Two Github Applications, [stale](https://probot.github.io/apps/stale/) for close Inactive Elements, and [boring-cyborg](https://probot.github.io/apps/boring-cyborg/) for setting labels by Existing roles, like changes at `./docs` allways get the Label `documentations`.

##### Usage
{%
include-markdown "../README.md"
start="<!--development-intro-start-->"
end="<!--development-intro-end-->"
%}
Loading

0 comments on commit 11deb9e

Please sign in to comment.