feat: github repo setup

A few changes to setup the GitHub repo for future contribution.
Includes:

- GHA workflow for labeling PRs based on size
- GHA workflow that requires a kind/* label on PRs
- GHA workflow for marking issues/prs as stale
- GHA workflow for running tests on PRs (i.e. build, test, verify)
- Dependabot configuration
- GitHub release notes configuration

Labels have also been created in the repo and these are used in the
above.

NOTE: the `make test` has been commented out from the tests for the time
being until the tests have been fixed.

Signed-off-by: Richard Case <richard.case@outlook.com>
This commit is contained in:
Richard Case 2022-11-02 12:38:33 +00:00
parent 581e8caadf
commit 02c965f113
No known key found for this signature in database
GPG Key ID: 317C835CDEA98CCD
12 changed files with 208 additions and 17 deletions

3
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,3 @@
@richardcase
@alexander-demicev
@belgaied2

22
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@ -0,0 +1,22 @@
---
name: Bug report
about: Tell us about a problem you are experiencing
title: ''
labels: kind/bug, needs-priority, needs-triage
assignees: ''
---
**What happened:**
[A clear and concise description of what the bug is.]
**What did you expect to happen:**
**How to reproduce it:**
**Anything else you would like to add:**
[Miscellaneous information that will assist in solving the issue.]
**Environment:**
- rke provider version:
- OS (e.g. from `/etc/os-release`):

15
.github/ISSUE_TEMPLATE/feature.md vendored Normal file
View File

@ -0,0 +1,15 @@
---
name: Feature request
about: Suggest an idea for the RKE2 Provider
title: ''
labels: kind/feature, needs-priority, needs-triage
assigness: ''
---
**Describe the solution you'd like:**
[A clear and concise description of what you want to happen.]
**Why do you want this feature:**
**Anything else you would like to add:**
[Miscellaneous information that will assist in solving the issue.]

26
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,26 @@
<!--
Label the PR with the kind of change this for:
kind/feature
kind/bug
kind/documentation
kind/regression
kind/*
-->
**What this PR does / why we need it**:
<!-- Enter a description of the change and why this change is needed -->
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
**Special notes for your reviewer**:
**Checklist**:
<!-- Put an "X" character inside the brackets of each completed task. Some may be optional depending on the PR in which case these can be deleted -->
- [ ] squashed commits into logical changes
- [ ] includes documentation
- [ ] adds unit tests
- [ ] adds or updates e2e tests

23
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
labels:
- "kind/cleanup"
- "area/dependency"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
labels:
- "kind/cleanup"
- "area/build-and-release"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "kind/cleanup"
- "area/build-and-release"

15
.github/release.yml vendored Normal file
View File

@ -0,0 +1,15 @@
changelog:
categories:
- title: 🚀 Enhancements
labels:
- kind/feature
- title: 🐛 Bugs
labels:
- kind/bug
- kind/regression
- title: 📖 Docs
labels:
- kind/documentation
- title: Other Changes
labels:
- "*"

View File

@ -1,4 +1,4 @@
name: golangci-lint
name: lint
on:
pull_request:
@ -11,19 +11,11 @@ jobs:
golangci:
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
working-directory:
- ""
- test
- hack/tools
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
with:
version: v1.49.0
working-directory: ${{matrix.working-directory}}
- name: Lint
run: make lint

21
.github/workflows/pr_size_labeler.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: pr_size_labeler
on: [pull_request]
jobs:
labeler:
runs-on: ubuntu-latest
name: Label the PR size
steps:
- uses: codelytv/pr-size-labeler@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xs_max_size: '50'
s_max_size: '200'
m_max_size: '100'
l_max_size: '2000'
fail_if_xl: 'false'
message_if_xl: >
This PR exceeds the recommended max size of 2000 lines.
Please make sure you are NOT addressing multiple issues with one PR
and split it up if possible 😊

20
.github/workflows/pr_type.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: pr_type
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
jobs:
check_pull_request_type:
name: Check for PR kind
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
one_of: kind/bug,kind/documentation,kind/feature,kind/regression,kind/refactor,kind/cleanup,kind/proposal
repo_token: ${{ secrets.GITHUB_TOKEN }}

31
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: '15 7 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v6
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 90
days-before-pr-stale: 90
days-before-issue-close: 365
days-before-pr-close: -1
stale-issue-message: 'This issue is stale because it has been open 90 days with no activity.'
stale-issue-label: 'lifecycle/stale'
stale-pr-message: 'This PR is stale because it has been open 90 days with no activity.'
stale-pr-label: 'lifecycle/stale'
close-issue-message: 'This issue was closed because it has been stalled for 365 days with no activity.'
close-issue-label: 'lifecycle/rotten'
exempt-issue-labels: 'lifecycle/frozen'
exempt-pr-labels: 'lifecycle/frozen'

22
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: run tests
on: [pull_request, workflow_dispatch]
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.19'
check-latest: true
cache: true
- name: Verify
run: make verify
- name: Build
run: make managers
# When make test is fixed we can re-enabled this
#- name: Test
# run: make test

View File

@ -93,6 +93,7 @@ GO_APIDIFF_PKG := github.com/joelanford/go-apidiff
HADOLINT_VER := v2.10.0
HADOLINT_FAILURE_THRESHOLD = warning
GOLANGCI_LINT_VER := v1.49.0
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN))
@ -159,7 +160,7 @@ generate-manifests-rke2-bootstrap: $(CONTROLLER_GEN) ## Generate manifests e.g.
.PHONY: generate-manifests-rke2-control-plane
generate-manifests-rke2-control-plane: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc. for RKE2 control plane provider
$(MAKE) clean-generated-yaml SRC_DIRS="./controlplane/rke2/config/crd/bases"
$(MAKE) clean-generated-yaml SRC_DIRS="./controlplane/config/crd/bases"
$(CONTROLLER_GEN) \
paths=./controlplane/api/... \
paths=./controlplane/internal/controllers/... \
@ -202,8 +203,8 @@ generate-modules: ## Run go mod tidy to ensure modules are up to date
.PHONY: lint
lint: $(GOLANGCI_LINT) ## Lint the codebase
cd $(CAPBPR_DIR); $(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS)
cd $(CAPRKE2_DIR); $(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS)
cd $(CAPBPR_DIR); $(GOLANGCI_LINT) run -v --timeout 3m $(GOLANGCI_LINT_EXTRA_ARGS)
cd $(CAPRKE2_DIR); $(GOLANGCI_LINT) run -v --timeout 3m $(GOLANGCI_LINT_EXTRA_ARGS)
./scripts/ci-lint-dockerfiles.sh $(HADOLINT_VER) $(HADOLINT_FAILURE_THRESHOLD)
.PHONY: lint-dockerfiles
@ -531,10 +532,10 @@ $(KUSTOMIZE): # Build kustomize from tools folder.
$(SETUP_ENVTEST): # Build setup-envtest from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(SETUP_ENVTEST_PKG) $(SETUP_ENVTEST_BIN) $(SETUP_ENVTEST_VER)
$(GOLANGCI_LINT): .github/workflows/golangci-lint.yml # Download golangci-lint using hack script into tools folder.
$(GOLANGCI_LINT): # Download and install golangci-lint
hack/ensure-golangci-lint.sh \
-b $(TOOLS_BIN_DIR) \
$(shell cat .github/workflows/golangci-lint.yml | grep [[:space:]]version | sed 's/.*version: //')
$(GOLANGCI_LINT_VER)
$(GH): # Download GitHub cli into the tools bin folder
hack/ensure-gh.sh \