Skip to content

Commit

Permalink
Add empty Kubebuilder project and GitHub workflows (#1)
Browse files Browse the repository at this point in the history
* Add empty Kubebuilder skeleton

* Add GitHub workflows

* Fix CI errors
  • Loading branch information
Gchbg committed Mar 19, 2024
1 parent 6a1c210 commit 843da7f
Show file tree
Hide file tree
Showing 41 changed files with 1,815 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Bug Report
about: Report a bug
labels: kind/bug

---

**What happened**:

**What you expected to happen**:

**How to reproduce it (as minimally and precisely as possible)**:

**Anything else we need to know**:

**Environment**:
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Enhancement Request
about: Suggest an enhancement
labels: kind/enhancement

---

**What would you like to be added**:

**Why is this needed**:
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
commit-message:
prefix: ""
reviewers:
- Gchbg
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
commit-message:
prefix: ""
reviewers:
- Gchbg
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
commit-message:
prefix: ""
reviewers:
- Gchbg
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
**What this PR does / why we need it**:

**Which issue(s) this PR fixes**:
Fixes #

**Special notes for your reviewer**:

**Release note**:
<!-- Write your release note:
1. Enter your release note in the below block.
2. If no release note is required, just write "NONE" within the block.
Format of block header: <category> <target_group>
Possible values:
- category: breaking|feature|bugfix|doc|other
- target_group: user|operator|developer|dependency
-->
```feature user
```
49 changes: 49 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependencies'
- 'documentation'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
exclude-labels:
- 'skip-changelog'
autolabeler:
- label: 'documentation'
files:
- '**/*.md'
branch:
- '/docs{0,1}\/.+/'
- label: 'bug'
branch:
- '/fix\/.+/'
title:
- '/fix/i'
- label: 'enhancement'
branch:
- '/feature\/.+/'
template: |
## Changes
$CHANGES
23 changes: 23 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Draft release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-drafter:
name: Draft release
runs-on: ubuntu-latest
steps:
- name: Draft release
uses: release-drafter/release-drafter@v6
with:
disable-releaser: github.ref != 'refs/heads/main'
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint

on: pull_request

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run linter
uses: golangci/golangci-lint-action@v4
70 changes: 70 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build and publish docker image

env:
platforms: linux/amd64,linux/arm64

on:
push:
branches:
- main
tags:
- v*
pull_request:

permissions:
contents: read
packages: write

jobs:
publish-docker:
name: Build and publish Docker image
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Collect metadata
uses: docker/metadata-action@v5
id: meta
with:
images: |
ghcr.io/${{ github.repository_owner }}/metal
tags: |
type=semver,pattern={{version}}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: ${{ env.platforms }}
- name: Set up Docker Buildx context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
timeout-minutes: 5
with:
version: latest
endpoint: builders
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
timeout-minutes: 60
with:
context: .
platforms: ${{ env.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
13 changes: 13 additions & 0 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check REUSE compliance

on: pull_request

jobs:
reuse:
name: Check REUSE compliance
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Run REUSE
uses: fsfe/reuse-action@v3
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test

on: pull_request

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run tests
run: make test
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin/*
Dockerfile.cross

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Go workspace file
go.work

# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
40 changes: 40 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
run:
deadline: 5m
allow-parallel-runners: true

issues:
# don't skip warning about doc comments
# don't exclude the default set of lint
exclude-use-default: false
# restore some of the defaults
# (fill in the rest as needed)
exclude-rules:
- path: "api/*"
linters:
- lll
- path: "internal/*"
linters:
- dupl
- lll
linters:
disable-all: true
enable:
- dupl
- errcheck
- exportloopref
- goconst
- gocyclo
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- prealloc
- staticcheck
- typecheck
- unconvert
- unparam
- unused
25 changes: 20 additions & 5 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: <YOUR-REPO-NAME>
Upstream-Contact: <YOUR-CONTACT (MAIL ADDRESS ETC.)>
Source: <https://github.com/ironcore-dev/YOUR-REPO-NAME>
Upstream-Name: metal
Upstream-Contact: IronCore authors <[email protected]>
Source: https://github.com/ironcore-dev/metal
Disclaimer: The code in this project may include calls to APIs ("API Calls") of
SAP or third-party products or services developed outside of this project
("External Products").
Expand All @@ -24,6 +24,21 @@ Disclaimer: The code in this project may include calls to APIs ("API Calls") of
you any rights to use or access any SAP External Product, or provide any third
parties the right to use of access any SAP External Product, through API Calls.

Files: <YOUR-FILE-OR-FOLDER-LIST>
Copyright: <YEARS-RELEVANT-FOR-YOUR-PROJECT> SAP SE or an SAP affiliate company and <YOUR-PROJECT-NAME> contributors
Files:
.github/*
cmd/*
config/*
hack/*
test/*
.dockerignore
.gitignore
.golangci.yml
CONTRIBUTING.md
Dockerfile
go.mod
go.sum
Makefile
PROJECT
README.md
Copyright: 2024 SAP SE or an SAP affiliate company and IronCore contributors
License: Apache-2.0
Loading

0 comments on commit 843da7f

Please sign in to comment.