-
Notifications
You must be signed in to change notification settings - Fork 90
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
Showing
6 changed files
with
238 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,64 @@ | ||
name: Commit Checks | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
base_sha: | ||
description: 'Base SHA to check from' | ||
required: true | ||
type: string | ||
head_sha: | ||
description: 'Head SHA to check until' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
commit_messages_checks: | ||
name: Commit messages checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install devbox | ||
uses: jetpack-io/devbox-install-action@v0.7.0 | ||
with: | ||
devbox-version: 0.8.5 | ||
enable-cache: 'true' | ||
|
||
- name: Check commit messages | ||
run: devbox run -- cz check --rev-range ${{ inputs.base_sha }}..${{ inputs.head_sha }} | ||
|
||
code_lint_checks: | ||
name: Code lint checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetpack-io/devbox-install-action@v0.7.0 | ||
with: | ||
devbox-version: 0.8.5 | ||
enable-cache: 'true' | ||
|
||
- name: Lint code | ||
run: devbox run lint | ||
|
||
test_checks: | ||
name: Test checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetpack-io/devbox-install-action@v0.7.0 | ||
with: | ||
devbox-version: 0.8.5 | ||
enable-cache: 'true' | ||
|
||
- name: Run tests | ||
run: devbox run test |
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,15 @@ | ||
name: main branch workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
commit_checks: | ||
name: Commit checks | ||
uses: ./.github/workflows/commit_checks.yml | ||
with: | ||
base_sha: ${{ github.event.before }} | ||
head_sha: ${{ github.event.after }} | ||
|
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,15 @@ | ||
name: PR workflow | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
commit_checks: | ||
name: Commit checks | ||
uses: ./.github/workflows/commit_checks.yml | ||
with: | ||
base_sha: ${{ github.event.pull_request.base.sha }} | ||
head_sha: ${{ github.event.pull_request.head.sha }} | ||
|
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,30 @@ | ||
name: Release workflow | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- '**' | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
create_release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetpack-io/devbox-install-action@v0.7.0 | ||
with: | ||
devbox-version: 0.8.5 | ||
enable-cache: 'true' | ||
|
||
- name: Publish release | ||
run: devbox run release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,25 @@ | ||
name: Release workflow | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Create bump and changelog | ||
uses: commitizen-tools/commitizen-action@master | ||
with: | ||
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
changelog_increment_filename: CHANGELOG.md | ||
|
||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: "CHANGELOG.md" | ||
tag_name: ${{ env.REVISION }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,89 @@ | ||
/* | ||
package servers | ||
|
||
import ( | ||
"github.com/gyuho/goraph" | ||
"strings" | ||
"fmt" | ||
) | ||
|
||
|
||
type DomainGraph struct { | ||
graph goraph.Graph | ||
roots []goraph.Node | ||
} | ||
|
||
|
||
func NewDomainGraph() *DomainGraph { | ||
res := &DomainGraph {} | ||
res.graph = goraph.NewGraph() | ||
return res | ||
} | ||
|
||
|
||
// | ||
//type DomainGraphNode { | ||
// name String | ||
// children []*DomainGraphNode | ||
//} | ||
// | ||
// | ||
func (g *DomainGraph) AddDomain(domain string) { | ||
splitted := strings.Split(domain,".") | ||
var parent goraph.Node = nil | ||
for i := len(splitted)-1; i >= 0; i-- { | ||
var curComp = splitted[i] | ||
node, err := g.graph.GetNode(goraph.StringID(curComp)) | ||
if err != nil { | ||
fmt.Printf("Node %s does not exist, add it\n", curComp) | ||
node = goraph.NewNode(curComp) | ||
g.graph.AddNode(node) | ||
} | ||
if parent == nil { | ||
parent = node | ||
g.roots = append(g.roots,node) | ||
} else { | ||
g.graph.AddEdge(parent.ID(),node.ID(),1) | ||
fmt.Printf("Add edge from %s to %s \n", parent, node) | ||
} | ||
} | ||
} | ||
|
||
func (g *DomainGraph) Display() { | ||
for _, c := range g.roots { | ||
g.displayNode(c) | ||
} | ||
} | ||
|
||
func (g *DomainGraph) displayNode(curNode goraph.Node) { | ||
fmt.Println("Node: %s visited", curNode.ID()) | ||
children, err := g.graph.GetTargets(curNode.ID()) | ||
fmt.Printf("Number of children: %i\n", len(children)) | ||
if err == nil { | ||
for _,c := range children { | ||
|
||
g.displayNode(c) | ||
} | ||
} | ||
} | ||
// | ||
// | ||
//func (g DomainGraph) RemoveDomain(domain String) { | ||
// | ||
//} | ||
// | ||
//func (g DomainGraph) getNodes(query String) []*DomainGraphNode { | ||
// splittedQuery = strings.Split(strings.ToLower(query), ".") | ||
//} | ||
// | ||
//func resolveDomain(query []String, n *DomainGraphNode) | ||
//{ | ||
//} | ||
// | ||
//func (n DomainGraphNode) Name() String { | ||
// return n.name | ||
//} | ||
// | ||
//func (n DomainGraphNode) Children() []*DomainGraphNode { | ||
// return n.children | ||
//}*/ |