Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nieomylnieja authored Aug 2, 2024
0 parents commit 02ce352
Show file tree
Hide file tree
Showing 34 changed files with 1,272 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Who's the owner of this repository?
# * @your-username
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a bug report to help us solve the issue.
title: "[BUG]"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior, ideally a minimal working example `main.go`.

**Expected behavior**
A clear and concise description of what you expected to happen.

**System details (please complete the following information)**
- OS (with version): [e.g. OS X 14.2.1, Ubuntu 22.04]
- SDK Version [e.g. v1.0.2]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Nobl9 Support
url: https://www.nobl9.com/contact/support
about: If you need help related to the whole Nobl9 platform or want the problem to remain private, contact us here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea to help us improve the SDK.
title: "[FEAT]"
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
If you're willing to contribute with a PR of your own, let us know!

**Additional context**
Add any other context or screenshots about the feature request here.
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 @@
## Motivation

Describe what is the motivation behind the proposed changes.
If possible reference the current solution/state of affairs.

## Summary

Recap of changed code.

## Related Changes

List related changes from other PRs (if any).

## Testing

- Describe how to check introduced code changes manually.
- Take care of test coverage on unit, integration or end-to-end levels.

## Release Notes

If this change should be part of the Release Notes,
**replace this entire paragraph** with 1-3 sentences about the changes.
Otherwise, you **MUST** remove this section entirely.

Does this PR contain any breaking changes?
If so, add `## Breaking Changes` header and list the introduced changes there.
88 changes: 88 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: ⚠️ Breaking Changes
labels:
- breaking-change
- title: 🚀 Features
labels:
- enhancement
- title: 💻 Fixed Vulnerabilities
labels:
- security
- title: 🐞 Bug Fixes
labels:
- bug
- title: 🧰 Maintenance
collapse-after: 3
labels:
- chore
- infrastructure
- dependencies
change-template: "- $TITLE (#$NUMBER) @$AUTHOR"
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
autolabeler:
# Pull requests scope.
- label: enhancement
title:
- "/^feat:/i"
- label: chore
title:
- "/^chore:/i"
- label: infrastructure
title:
- "/^infra:/i"
- label: security
title:
- "/^sec:/i"
- label: bug
title:
- "/^fix:/i"
- label: documentation
title:
- "/^doc:/i"
- label: breaking-change
body:
- '/^## Breaking Changes/im'
# Version labels.
- label: minor
title:
- "/^feat:/i"
- label: patch
title:
- "/^fix:/i"
- "/^sec:/i"
- "/^chore:/i"
branch:
- '/^renovate_/'
# Languages detection.
- label: go
files:
- '*.go'
- 'go.mod'
- 'go.sum'
- label: python
files:
- '*.py'
- label: javascript
files:
- '*.js'
replacers:
# Remove unlabeled or uncategorized PRs.
- search: "/# What's Changed.*?\\n## /s"
replace: "# What's Changed\n\n## "
template: |
# What's Changed
$CHANGES
62 changes: 62 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"schedule:nonOfficeHours", // https://docs.renovatebot.com/presets-schedule/#schedulenonofficehours
":enableVulnerabilityAlertsWithLabel(security)", // https://docs.renovatebot.com/presets-default/#enablevulnerabilityalertswithlabelarg0
"group:recommended", // https://docs.renovatebot.com/presets-group/#grouprecommended
"workarounds:all", // https://docs.renovatebot.com/presets-workarounds/#workaroundsall
// Automerge configuration.
":automergeMinor",
":automergePr",
":automergeRequireAllStatusChecks",
],
"reviewersFromCodeOwners": true,
"dependencyDashboard": true,
"semanticCommits": "disabled",
"labels": ["dependencies", "renovate"],
"prHourlyLimit": 1,
"prConcurrentLimit": 5,
"rebaseWhen": "conflicted",
"rangeStrategy": "pin",
"branchPrefix": "renovate_",
"commitMessagePrefix": "chore:",
// This will run go mod tidy after each go.mod update.
"postUpdateOptions": ["gomodTidy"],
// Groups:
"packageRules": [
{
"matchManagers": ["gomod"],
"matchUpdateTypes": [
"minor",
"patch",
],
"groupName": "minor and patch Golang dependencies",
},
{
"matchManagers": ["github-actions"],
"addLabels": ["github-actions"],
},
{
"matchManagers": ["gomod"],
"addLabels": ["golang"],
},
{
"matchManagers": ["npm"],
"addLabels": ["javascript"],
},
],
// Custom version extraction from Makefile.
"regexManagers": [
{
"fileMatch": ["^Makefile$"],
"matchStrings": [
".*renovate datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\n.*?_VERSION\\s?:=\\s?(?<currentValue>.*)\\s"
]
}
],
"ignorePaths": [
"**/vendor/**",
"**/node_modules/**",
"**/test_data/**",
]
}
79 changes: 79 additions & 0 deletions .github/scripts/release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env bash

set -euo pipefail

if [ "$#" -ne 1 ]; then
echo "Provide a single argument with a version of the release draft to use." >&2
echo "Usage: $0 <VERSION>"
exit 1
fi

VERSION="$1"

RELEASE_NOTES=$(gh release view "$VERSION" --json body --jq .body)

BREAKING_CHANGES_HEADER="Breaking Changes"
RELEASE_NOTES_HEADER="Release Notes"

commit_message_re="-\s(.*)\s(\(#[0-9]+\)\s@.*)"
rls_header_re="^##.*(Features|$BREAKING_CHANGES_HEADER|Bug Fixes|Fixed Vulnerabilities)"

extract_header() {
local commit="$1"
local header_name="$2"
awk "
/^\s?$/ {next};
/^--+/ {rn=0};
/^Signed-off-by|Co-authored-by/ {rn=0};
/^## $header_name/ {rn=1};
rn && !/^##/ && !/^--+/ {print};
/^##/ && !/^## $header_name/ {rn=0}" <<<"$commit"
}

indent() {
while IFS= read -r line; do
printf " %s\n" "${line%"${line##*[![:space:]]}"}"
done <<<"$1"
}

new_notes=""
rls_header=""
while IFS= read -r line; do
new_notes+="$line\n"
if [[ $line == \##* ]]; then
if ! [[ $line =~ $rls_header_re ]]; then
rls_header=""
continue
fi
rls_header="${BASH_REMATCH[1]}"
fi
if [[ $rls_header == "" ]] || [[ $line != -* ]] || [[ $line == *"@renovate"* ]]; then
continue
fi
if ! [[ $line =~ $commit_message_re ]]; then
continue
fi
commit_msg="${BASH_REMATCH[1]}"
commit_body=$(git log -F --grep "$commit_msg" -n1 --pretty="%b")

add_notes() {
local notes="$1"
if [[ $notes != "" ]]; then
new_notes+=$(indent "> $notes")
new_notes+="\n"
fi
}

rn=$(extract_header "$commit_body" "$RELEASE_NOTES_HEADER")
bc=$(extract_header "$commit_body" "$BREAKING_CHANGES_HEADER")

case $rls_header in
"$BREAKING_CHANGES_HEADER") add_notes "$bc" ;;
*) add_notes "$rn" ;;
esac

done <<<"$RELEASE_NOTES"

echo "Uploading release notes for $VERSION"
# shellcheck disable=2059
printf "$new_notes" | gh release edit "$VERSION" --verify-tag -F -
44 changes: 44 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Checks
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
name: Run all checks for static analysis
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Set up prerequisites - node and yarn
uses: actions/setup-node@v4
- name: Set up yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run spell and markdown checkers
run: make check/spell check/trailing check/markdown
- name: Check generated code
run: make check/generate
- name: Check formatting
run: make check/format
- name: Run go vet
run: make check/vet
- name: Run golangci-lint
run: make check/lint
- name: Run Gosec Security Scanner
run: make check/gosec
13 changes: 13 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
pull_request:
types: [opened, reopened, edited, synchronize]
merge_group:
name: pr-title
jobs:
pr-title-check:
runs-on: ubuntu-latest
steps:
- uses: Slashgear/action-check-pr-title@v4.3.0
with:
regexp: "^(feat|fix|sec|infra|test|chore|doc): .{5,}"
helpMessage: "Example: 'feat: new pr title check BE-143' <- prefix, colon, space, PR title of at least 5 chars (with ticket number strongly suggested, but not mandatory)"
Loading

0 comments on commit 02ce352

Please sign in to comment.