-
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.
Move ndc rest schema to ndc-rest monorepo (#23)
- Loading branch information
Showing
99 changed files
with
30,692 additions
and
234 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,10 @@ | ||
#!/bin/bash | ||
|
||
export CLI_VERSION=$GITHUB_REF_NAME | ||
export MACOS_AMD64_SHA256=$(sha256sum "_output/ndc-rest-schema-darwin-amd64" | awk '{ print $1 }') | ||
export MACOS_ARM64_SHA256=$(sha256sum "_output/ndc-rest-schema-darwin-arm64" | awk '{ print $1 }') | ||
export LINUX_AMD64_SHA256=$(sha256sum "_output/ndc-rest-schema-linux-amd64" | awk '{ print $1 }') | ||
export LINUX_ARM64_SHA256=$(sha256sum "_output/ndc-rest-schema-linux-arm64" | awk '{ print $1 }') | ||
export WINDOWS_AMD64_SHA256=$(sha256sum "_output/ndc-rest-schema-windows-amd64.exe" | awk '{ print $1 }') | ||
|
||
envsubst < .github/scripts/plugin-manifest.yaml > release/manifest.yaml |
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,41 @@ | ||
name: ndc-rest | ||
version: "${CLI_VERSION}" | ||
shortDescription: "CLI plugin for Hasura REST data connector" | ||
homepage: https://github.com/hasura/ndc-rest | ||
hidden: true | ||
platforms: | ||
- selector: darwin-arm64 | ||
uri: "https://github.com/hasura/ndc-rest/releases/download/${CLI_VERSION}/ndc-rest-schema-darwin-arm64" | ||
sha256: "${MACOS_ARM64_SHA256}" | ||
bin: "ndc-rest-schema" | ||
files: | ||
- from: "./ndc-rest-schema-darwin-arm64" | ||
to: "ndc-rest-schema" | ||
- selector: linux-arm64 | ||
uri: "https://github.com/hasura/ndc-rest/releases/download/${CLI_VERSION}/ndc-rest-schema-linux-arm64" | ||
sha256: "${LINUX_ARM64_SHA256}" | ||
bin: "ndc-rest-schema" | ||
files: | ||
- from: "./ndc-rest-schema-linux-arm64" | ||
to: "ndc-rest-schema" | ||
- selector: darwin-amd64 | ||
uri: "https://github.com/hasura/ndc-rest/releases/download/${CLI_VERSION}/ndc-rest-schema-darwin-amd64" | ||
sha256: "${MACOS_AMD64_SHA256}" | ||
bin: "ndc-rest-schema" | ||
files: | ||
- from: "./ndc-rest-schema-darwin-amd64" | ||
to: "ndc-rest-schema" | ||
- selector: windows-amd64 | ||
uri: "https://github.com/hasura/ndc-rest/releases/download/${CLI_VERSION}/ndc-rest-schema-windows-amd64.exe" | ||
sha256: "${WINDOWS_AMD64_SHA256}" | ||
bin: "ndc-rest-schema.exe" | ||
files: | ||
- from: "./ndc-rest-schema-windows-amd64.exe" | ||
to: "ndc-rest-schema.exe" | ||
- selector: linux-amd64 | ||
uri: "https://github.com/hasura/ndc-rest/releases/download/${CLI_VERSION}/ndc-rest-schema-linux-amd64" | ||
sha256: "${LINUX_AMD64_SHA256}" | ||
bin: "ndc-rest-schema" | ||
files: | ||
- from: "./ndc-rest-schema-linux-amd64" | ||
to: "ndc-rest-schema" |
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,46 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
paths: | ||
- "**.go" | ||
- "go.mod" | ||
- "go.sum" | ||
- ".github/workflows/*.yaml" | ||
|
||
env: | ||
GO_VERSION: 1.23 | ||
|
||
jobs: | ||
detect-modules: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
modules: ${{ steps.set-modules.outputs.modules }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- id: set-modules | ||
run: echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT | ||
|
||
golangci-lint: | ||
needs: detect-modules | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Format | ||
run: | | ||
diff -u <(echo -n) <(gofmt -d -s .) | ||
cd ndc-rest-schema && diff -u <(echo -n) <(gofmt -d -s .) | ||
- name: golangci-lint ${{ matrix.modules }} | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
args: --timeout=5m | ||
working-directory: ${{ matrix.modules }} |
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
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,44 @@ | ||
linters: | ||
enable-all: true | ||
disable: | ||
- err113 | ||
- lll | ||
- gocognit | ||
- gocritic | ||
- nestif | ||
- execinquery | ||
- exportloopref | ||
- gomnd | ||
- funlen | ||
- godot | ||
- gofumpt | ||
- gomoddirectives | ||
- depguard | ||
- gosec | ||
- revive | ||
- cyclop | ||
- wsl | ||
- wrapcheck | ||
- varnamelen | ||
- nlreturn | ||
- exhaustive | ||
- exhaustruct | ||
- gocyclo | ||
- prealloc | ||
- ireturn | ||
- gochecknoglobals | ||
- gocyclo | ||
- godox | ||
- stylecheck | ||
- nilnil | ||
- maintidx | ||
- mnd | ||
- tagliatelle | ||
- goconst | ||
- noctx | ||
- unparam | ||
- forbidigo | ||
|
||
issues: | ||
exclude-files: | ||
- ".*_test\\.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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,13 +1,48 @@ | ||
VERSION ?= $(shell date +"%Y%m%d") | ||
OUTPUT_DIR := _output | ||
|
||
.PHONY: format | ||
format: | ||
gofmt -w -s . | ||
cd ndc-rest-schema && gofmt -w -s . | ||
|
||
.PHONY: test | ||
test: | ||
go test -v -race -timeout 3m ./... | ||
cd ndc-rest-schema && go test -v -race -timeout 3m ./... | ||
|
||
# Install golangci-lint tool to run lint locally | ||
# https://golangci-lint.run/usage/install | ||
.PHONY: lint | ||
lint: | ||
golangci-lint run | ||
golangci-lint run --fix | ||
cd ndc-rest-schema && golangci-lint run --fix | ||
|
||
# clean the output directory | ||
.PHONY: clean | ||
clean: | ||
rm -rf "$(OUTPUT_DIR)" | ||
|
||
.PHONY: go-tidy | ||
go-tidy: | ||
go mod tidy | ||
cd ndc-rest-schema && go mod tidy | ||
|
||
.PHONY: build-jsonschema | ||
build-jsonschema: | ||
cd ./ndc-rest-schema/jsonschema && go run . | ||
|
||
# build the ndc-rest-schema for all given platform/arch | ||
.PHONY: build-cli | ||
build-cli: | ||
go build -o _output/ndc-rest-schema ./ndc-rest-schema | ||
|
||
.PHONY: ci-build-cli | ||
ci-build-cli: export CGO_ENABLED=0 | ||
ci-build-cli: clean | ||
cd ./ndc-rest-schema && \ | ||
go get github.com/mitchellh/gox && \ | ||
go run github.com/mitchellh/gox -ldflags '-X github.com/hasura/ndc-rest/ndc-rest-schema/version.BuildVersion=$(VERSION) -s -w -extldflags "-static"' \ | ||
-osarch="linux/amd64 darwin/amd64 windows/amd64 darwin/arm64" \ | ||
-output="../$(OUTPUT_DIR)/ndc-rest-schema-{{.OS}}-{{.Arch}}" \ | ||
. |
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.