Skip to content

Commit

Permalink
chore: Initial code import
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Henri Symoneaux <[email protected]>
  • Loading branch information
phsym committed Jan 31, 2025
0 parents commit a6a3fe0
Show file tree
Hide file tree
Showing 525 changed files with 142,608 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/actions/lint-commit/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint Conventional Commits
description: Verify that all the commits complies to the conventional commit convention

inputs:
config:
description: Path to the configuration file
default: .github/commitlint.config.js

runs:
using: composite
steps:
- name: Install commitlint
shell: bash
run: |
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest
npm install @commitlint/{cli,config-conventional}
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
shell: bash
run: npx commitlint --config ${{ inputs.config }} --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
shell: bash
run: npx commitlint --config ${{ inputs.config }} --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
10 changes: 10 additions & 0 deletions .github/actions/setup-build-env/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Setup Build Env
description: Setup build environment with go

runs:
using: composite
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"
14 changes: 14 additions & 0 deletions .github/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const Configuration = {
// See https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/src/index.ts
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [
0,
'never',
// Allow Sentence-case. See https://commitlint.js.org/reference/rules.html#subject-case
['start-case', 'pascal-case', 'upper-case']
]
}
};

module.exports = Configuration;
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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: github-actions
directory: /
schedule:
interval: weekly
reviewers:
- ovh/kms
- package-ecosystem: "gomod"
directories:
- "/"
schedule:
interval: "weekly"
allow:
- dependency-type: all
reviewers:
- ovh/kms
open-pull-requests-limit: 10
86 changes: 86 additions & 0 deletions .github/release-note.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# changelog header
header = ""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}
{% set breaking = (commits | filter(attribute="breaking", value=true) | map(attribute="breaking_description")) -%}
{% if breaking -%}
### ⚠️ BREAKING CHANGES:
{% for bk in breaking %}
- {{ bk -}}
{% endfor %}
{% endif %}
"""
# template for the changelog footer
footer = ""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci|^build\\(deps\\)", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
# tag_pattern = "v[0-9].*"
# regex for skipping tags
# skip_tags = ""
# regex for ignoring tags
# ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42
21 changes: 21 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: pull-request

on:
pull_request:
branches: ["main"]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Lint commits
if: github.event.pull_request.user.login != 'dependabot[bot]'
uses: ./.github/actions/lint-commit

build:
needs:
- commitlint
uses: ./.github/workflows/test.yaml
43 changes: 43 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release

on:
push:
# run only against tags
tags:
- "v*"

permissions:
contents: write
packages: write

jobs:
test:
uses: ./.github/workflows/test.yaml
secrets: inherit

release:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- run: git fetch --force --tags
- uses: ./.github/actions/setup-build-env
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
with:
config: .github/release-note.toml
args: --verbose --current
env:
OUTPUT: tmp.CHANGELOG.md
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
# prerelease: true
name: ${{ github.ref_name }}
# draft: true
body_path: tmp.CHANGELOG.md

30 changes: 30 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: test

on:
push:
branches: ["main"]
workflow_call: {}

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-build-env
- name: Unit Test
run: go test -race -v ./...
- name: Run benchmarks
run: go test -benchmem -bench . -run ^$ ./...

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-build-env
- name: Lint library
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
certs/
dist/
.build/
*.pem
*.log
*.db
*.exe

bin/
git-cliff-*
tmp.CHANGELOG.md
14 changes: 14 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This is the official list of kmip-go authors for copyright purposes.
# This file is distinct from the CONTRIBUTORS files
# and it lists the copyright holders only.

# Names should be added to this file as one of
# Organization's name
# Individual's name <submission email address>
# Individual's name <submission email address> <email2> <emailN>
# See CONTRIBUTORS for the meaning of multiple email addresses.

# Please keep the list sorted.

OVH SAS
Pierre-Henri Symoneaux <[email protected]>
Loading

0 comments on commit a6a3fe0

Please sign in to comment.