-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b697d61
Showing
18 changed files
with
533 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
tab_width = 4 | ||
indent_style = space | ||
max_line_length = 120 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[{*.go}] | ||
indent_style = tab | ||
|
||
[{*.md,LICENSE}] | ||
max_line_length = 80 | ||
|
||
[{*.yml,*.yaml,*.json}] | ||
indent_size = 2 | ||
tab_width = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
rules: { | ||
'body-leading-blank': [2, 'always'], | ||
'body-max-line-length': [2, 'always', 100], | ||
'header-max-length': [2, 'always', 100], | ||
'scope-case': [2, 'always', 'lower-case'], | ||
'subject-case': [ | ||
2, | ||
'never', | ||
['start-case', 'pascal-case', 'upper-case'], | ||
], | ||
'subject-empty': [2, 'never'], | ||
'subject-full-stop': [2, 'never', '.'], | ||
'type-enum': [ | ||
2, | ||
'always', | ||
[ | ||
'chore', | ||
'build', | ||
'ci', | ||
'docs', | ||
'feat', | ||
'feat!', | ||
'fix', | ||
'perf', | ||
'refactor', | ||
'test' | ||
], | ||
], | ||
'type-case': [2, 'always', 'lower-case'], | ||
'type-empty': [2, 'never'], | ||
'signed-off-by': [2, 'always'] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/.github/workflows" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Lint commit message | ||
|
||
on: [push] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Clone | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup node 20 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
check-latest: true | ||
|
||
- name: Install commitlint | ||
run: npm install -g @commitlint/cli @commitlint/config-conventional | ||
|
||
- name: Lint commit message | ||
run: echo "${{ github.event.head_commit.message }}" | commitlint --config .github/commitlint.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Go Workflow (Push) | ||
|
||
on: | ||
push: | ||
branches: ["**"] | ||
pull_request: | ||
branches: ["**"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.20" | ||
check-latest: true | ||
|
||
- name: Build | ||
run: go build ./... | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.20" | ||
check-latest: true | ||
|
||
- name: Format | ||
run: | | ||
OUT="$(go fmt $(go list ./... | grep -v /vendor/) 2>&1)" | ||
if [ -n "$OUT" ]; then | ||
echo "The following files are not correctly formatted" | ||
echo "${OUT}" | ||
exit 1 | ||
fi | ||
- name: Test | ||
run: go test -json ./... | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.20" | ||
check-latest: true | ||
|
||
- name: Format | ||
run: | | ||
OUT="$(go fmt $(go list ./... | grep -v /vendor/) 2>&1)" | ||
if [ -n "$OUT" ]; then | ||
echo "The following files are not correctly formatted" | ||
echo "${OUT}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Go Workflow (Release) | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.20" | ||
check-latest: true | ||
|
||
- name: Build | ||
run: go build ./... | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.20" | ||
check-latest: true | ||
|
||
- name: Format | ||
run: | | ||
OUT="$(go fmt $(go list ./... | grep -v /vendor/) 2>&1)" | ||
if [ -n "$OUT" ]; then | ||
echo "The following files are not correctly formatted" | ||
echo "${OUT}" | ||
exit 1 | ||
fi | ||
- name: Test | ||
run: go test -json ./... | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.20" | ||
check-latest: true | ||
|
||
- name: Format | ||
run: | | ||
OUT="$(go fmt $(go list ./... | grep -v /vendor/) 2>&1)" | ||
if [ -n "$OUT" ]; then | ||
echo "The following files are not correctly formatted" | ||
echo "${OUT}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"recommendations": [ | ||
"streetsidesoftware.code-spell-checker", | ||
"editorconfig.editorconfig", | ||
"davidanson.vscode-markdownlint", | ||
"sonarsource.sonarlint-vscode", | ||
"wayou.vscode-todo-highlight", | ||
"redhat.vscode-yaml", | ||
"golang.go" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"cSpell.language": "en", | ||
"editor.formatOnSave": true, | ||
"editor.wordWrap": "on", | ||
"editor.rulers": [ | ||
80, | ||
120 | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"checkRunSettings": { | ||
"vulnerableCheckRunConclusionLevel": "failure" | ||
}, | ||
"issueSettings": { | ||
"minSeverityLevel": "LOW" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Code of Conduct | ||
|
||
Actually, the author is hungry and does not want to write a novel here. So, | ||
please just act like a normal human and treat others the same way as you want to | ||
be treated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Contributing | ||
|
||
When contributing to this repository, please first discuss the change in the | ||
discussions. | ||
|
||
Please note we have a code of conduct, please follow it in all your interactions | ||
with the project. | ||
|
||
## Coding | ||
|
||
1. Fork the repository. | ||
2. Make your changes on a dedicated branch. | ||
3. Commit your changes according | ||
to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0). | ||
Please try to only make one commit. Squash/rebase if you made a bunch of | ||
fix-up-commits! Commits will be linted on every push. | ||
4. Open up a pull request by using the `Fix`, `Feature` or `Breaking` pull | ||
request template and follow the steps described there. | ||
5. Merge the pull request as described in the template and make | ||
a [release](#release) if required. | ||
|
||
## Release | ||
|
||
Open an issue by using the template `Release` and follow the steps in there. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Manifesto | ||
|
||
[](https://github.com/yannickkirschen/manifesto/actions/workflows/commit-lint.yml) | ||
[](https://github.com/yannickkirschen/manifesto/actions/workflows/push.yml) | ||
[](https://github.com/yannickkirschen/manifesto/actions/workflows/release.yml) | ||
[](https://github.com/yannickkirschen/manifesto/releases/) | ||
|
||
Manifesto is a library that manages declarative APIs using the listener pattern, | ||
just like Kubernetes with its resources and operators. | ||
|
||
> [!WARNING] | ||
> This project is currently under heavy development and not stable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/yannickkirschen/manifesto" | ||
) | ||
|
||
type MySpec struct { | ||
Message string `yaml:"message" json:"message"` | ||
} | ||
|
||
func MyListener(action manifesto.Action, manifest *manifesto.Manifest) { | ||
if manifest.ApiVersion != "example.com/v1alpha1" || manifest.Kind != "MyManifest" { | ||
return | ||
} | ||
|
||
spec := manifest.Spec.(*MySpec) | ||
|
||
switch action { | ||
case manifesto.Created: | ||
fmt.Println("Created:", spec.Message) | ||
case manifesto.Updated: | ||
fmt.Println("Updated:", spec.Message) | ||
case manifesto.Deleted: | ||
fmt.Println("Deleted:", spec.Message) | ||
} | ||
} | ||
|
||
func main() { | ||
m := manifesto.ParseFile("example/my-manifest.yaml", &MySpec{}, &MySpec{}) | ||
|
||
pool := manifesto.CreatePool() | ||
pool.Listen(MyListener) | ||
pool.Apply(m) | ||
|
||
m3 := pool.GetByKey(m.CreateKey()) | ||
pool.Delete(m3.CreateKey()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: example.com/v1alpha1 | ||
kind: MyManifest | ||
metadata: | ||
name: my-manifest | ||
spec: | ||
message: hello, world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/yannickkirschen/manifesto | ||
|
||
go 1.20 | ||
|
||
require gopkg.in/yaml.v3 v3.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
Oops, something went wrong.