feat(hasura.io): Add package for the Hasura CLI (#2720)

* feat(hasura.io): Add package for Hasura
* fix: build make target
* fix: Use Make v3
* fix: Use Make v4
* comments
* fix: Use Make 4.3.0
* fix: Skip checksums

Co-authored-by: Max Howell <mxcl@me.com>
This commit is contained in:
Kevin Chen 2023-08-02 14:03:33 -04:00 committed by GitHub
parent 1479fe023b
commit 13291c3cf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 1 deletions

View file

@ -0,0 +1,51 @@
distributable:
url: https://github.com/hasura/graphql-engine/archive/refs/tags/v{{version}}.tar.gz
strip-components: 1
versions:
github: hasura/graphql-engine
provides:
- bin/hasura
build:
# I copied the brew formula here --mxcl
# NOTE there is a `Makefile`, possibly not using it is asking for trouble
script:
- working-directory: cli-ext
run:
- npm update pkg # see https://github.com/hasura/graphql-engine/issues/9440
- |
npm install --global --build-from-source --prefix={{prefix}}
npm run prebuild
node_modules/.bin/pkg ./build/command.js --output ./bin/cli-ext-hasura -t host
- working-directory: cli
run: |
cp ../cli-ext/bin/cli-ext-hasura internal/cliext/static-bin/$PLATFORM/cli-ext
go build -v -ldflags="$LDFLAGS" -o="{{prefix}}/bin/hasura" ./cmd/hasura
dependencies:
go.dev: ^1.16
npmjs.com: ^8.19.4
gnu.org/coreutils: '*'
nodejs.org: ^18 # fails with ^20
env:
darwin/aarch64: {PLATFORM: darwin/arm64}
darwin/x86-64: {PLATFORM: darwin/amd64}
linux/aarch64: {PLATFORM: linux/arm64}
linux/x86-64: {PLATFORM: linux/amd64}
LDFLAGS:
- -s
- -w
- -X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion={{version}}
- -X github.com/hasura/graphql-engine/cli/v2/plugins.IndexBranchRef=master
linux:
# or segmentation fault
# fix found here https://github.com/docker-library/golang/issues/402#issuecomment-982204575
LDFLAGS:
- -buildmode=pie
test: |
hasura --skip-update-check version | grep {{version}}
hasura init testdir

View file

@ -1,4 +1,4 @@
dependencies:
tea.xyz/brewkit: '>=0.28.1'
tea.xyz/brewkit: ^0.44
env:
TEA_PANTRY_PATH: ${{srcroot}}