Skip to content

Commit

Permalink
feat(ci): added CI workflows and GitHub automations
Browse files Browse the repository at this point in the history
  • Loading branch information
leonsteinhaeuser committed Nov 27, 2023
1 parent 4c434f8 commit 036ca94
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @tagesspiegel/platform-engineers
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: "weekly"
labels:
- dep/go
- dependabot
- package-ecosystem: docker
directory: "/"
schedule:
interval: "weekly"
labels:
- dep/docker
- dependabot
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
labels:
- dep/gh-actions
- dependabot
7 changes: 7 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# source: https://github.com/TimonVS/pr-labeler-action
feature: ['feature/*', 'feat/*']
enhancement: ['enhancement/*', 'enhance/*', "enh/*"]
fix: ['fix/*', 'bugfix/*', "bug-fix/*"]
documentation: ['docs/*', 'doc/*', 'documentation/*']
chore: ['chore/*', 'ch/*']
refactor: ['refactor/*', 'ref/*']
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Test A
- [ ] Test B

**Test Configuration**:

- Kubernetes version:
- Kubectl version:
- Node operation system:

## Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
36 changes: 36 additions & 0 deletions .github/workflows/pr_automation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Pull Request automations

on: pull_request

jobs:
size-label:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Add size label
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IGNORED: ".gitignore\n*.md\n*.MD\n*.json\n*.sql\n*.yaml\n*.yml\n.dockerignore\ngo.mod\ngo.sum\nLICENSE"
with:
sizes: >
{
"0": "XS",
"50": "S",
"250": "M",
"500": "L",
"1000": "XL",
"2000": "XXL"
}
pr-labeler:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: TimonVS/pr-labeler-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release

on:
push:
tags:
- "v*"

env:
go_version: "1.21"

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
clean: true
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
cache: false
- run: go mod tidy
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 changes: 65 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: testing

on:
push:
branches:
- "**"

env:
go_version: "1.21"

jobs:
vetting:
name: vetting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
ref: ${{ github.ref }}

- uses: actions/setup-go@v4
with:
go-version: ${{ env.go_version }}

- name: vetting
shell: bash
run: go vet ./...

linting:
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
ref: ${{ github.ref }}

- uses: actions/setup-go@v4
with:
go-version: ${{ env.go_version }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=3m --issues-exit-code=1 ./...
only-new-issues: true

unit-tests:
runs-on: ubuntu-latest
needs:
- vetting
- linting
env:
COVER_FILE: coverage.out
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version}}
- run: go mod tidy
- name: Run unit tests
run: go test -coverprofile=$COVER_FILE -covermode=atomic ./...
56 changes: 56 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
project_name: helm-plugin-bootstrap

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: binary
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_{{ .Arch }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
release:
draft: false
prerelease: auto
name_template: "Release {{ .Tag }}"
mode: prepend
header: |
## Release {{ .Tag }} on {{ .Date }}
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"

changelog:
use: github
sort: asc
groups:
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: "Enhancements"
regexp: "^.*enhancement[(\\w)]*:+.*$"
order: 2
- title: Others
order: 999
filters:
exclude:
- "^docs:"
- "^test:"
- "^Merge branch"
- "^chore(deps):"

0 comments on commit 036ca94

Please sign in to comment.