-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(jsonschema): relocate schema generator (#1219)
- Loading branch information
Showing
31 changed files
with
724 additions
and
31 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,35 @@ | ||
# name of the action | ||
name: jsonschema | ||
|
||
# trigger on release events | ||
on: | ||
release: | ||
types: [created] | ||
|
||
# pipeline to execute | ||
jobs: | ||
schema: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: clone | ||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
|
||
- name: install go | ||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
# use version from go.mod file | ||
go-version-file: "go.mod" | ||
cache: true | ||
check-latest: true | ||
|
||
- name: build | ||
run: | | ||
make jsonschema | ||
- name: upload | ||
uses: skx/github-action-publish-binaries@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: "schema.json" |
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 |
---|---|---|
|
@@ -12,23 +12,29 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: clone | ||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
|
||
- name: install go | ||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
# use version from go.mod file | ||
go-version-file: 'go.mod' | ||
cache: true | ||
check-latest: true | ||
|
||
- name: test | ||
run: | | ||
make test | ||
- name: coverage | ||
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: coverage.out | ||
- name: clone | ||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
|
||
- name: install go | ||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
# use version from go.mod file | ||
go-version-file: "go.mod" | ||
cache: true | ||
check-latest: true | ||
|
||
- name: test | ||
run: | | ||
make test | ||
- name: test jsonschema | ||
run: | | ||
go install github.com/santhosh-tekuri/jsonschema/cmd/[email protected] | ||
make test-jsonschema | ||
- name: coverage | ||
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: coverage.out | ||
|
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
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
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,29 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/sirupsen/logrus" | ||
|
||
"github.com/go-vela/server/schema" | ||
) | ||
|
||
func main() { | ||
js, err := schema.NewPipelineSchema() | ||
if err != nil { | ||
logrus.Fatal("schema generation failed:", err) | ||
} | ||
|
||
// output json | ||
j, err := json.MarshalIndent(js, "", " ") | ||
if err != nil { | ||
logrus.Fatal(err) | ||
} | ||
|
||
fmt.Printf("%s\n", j) | ||
} |
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
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
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
Oops, something went wrong.