mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 04:57:08 +00:00
feat: introduce Taskfile automation for build and deployment
This commit is contained in:
parent
fcc915a115
commit
77bbf6bba7
31
.github/taskfiles/Buf.yml
vendored
Normal file
31
.github/taskfiles/Buf.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
GOPATH:
|
||||
sh: go env GOPATH
|
||||
BIN_DIR: "{{.GOPATH}}/bin"
|
||||
BINARY: "{{.BIN_DIR}}/hway"
|
||||
OS:
|
||||
sh: uname -s
|
||||
ARCH:
|
||||
sh: uname -m
|
||||
|
||||
tasks:
|
||||
proto:
|
||||
desc: Generate proto files
|
||||
silent: true
|
||||
cmd: gum spin --spinner dot --title "Generating Protobufs..." -- make proto-gen
|
||||
|
||||
sqlc:
|
||||
desc: Generate SQLC files
|
||||
silent: true
|
||||
cmds:
|
||||
- gum spin --spinner dot --title "Generating SQLC..." -- sqlc generate -f internal/database/sqlc.yaml
|
||||
|
||||
templ:
|
||||
desc: Generate templ files
|
||||
silent: true
|
||||
cmd: gum spin --spinner dot --title "Generating Templ..." -- templ generate
|
||||
|
||||
|
26
.github/taskfiles/Bun.yml
vendored
Normal file
26
.github/taskfiles/Bun.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
logi-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l info {{.TEXT}}
|
||||
|
||||
logw-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l warn {{.TEXT}}
|
||||
|
||||
loge-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l error {{.TEXT}}
|
||||
|
||||
logd-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l debug {{.TEXT}}
|
37
.github/taskfiles/Docker.yml
vendored
Normal file
37
.github/taskfiles/Docker.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
ROOT:
|
||||
sh: git rev-parse --show-toplevel
|
||||
|
||||
tasks:
|
||||
build:
|
||||
desc: Build all matrix docker images
|
||||
cmds:
|
||||
- task: docker-build-push
|
||||
vars:
|
||||
DOCKER_FILE: deploy/matrixhs/server.Dockerfile
|
||||
DOCKER_IMAGE: onsonr/synapse
|
||||
- task: docker-build-push
|
||||
vars:
|
||||
DOCKER_FILE: deploy/matrixhs/hooks.Dockerfile
|
||||
DOCKER_IMAGE: onsonr/hookshot
|
||||
- task: docker-build-push
|
||||
vars:
|
||||
DOCKER_FILE: deploy/matrixhs/sync.Dockerfile
|
||||
DOCKER_IMAGE: onsonr/sliding-sync
|
||||
- task: docker-build-push
|
||||
vars:
|
||||
DOCKER_FILE: deploy/matrixhs/web.Dockerfile
|
||||
DOCKER_IMAGE: onsonr/element-web
|
||||
silent: true
|
||||
|
||||
docker-build-push:
|
||||
internal: true
|
||||
vars:
|
||||
required: [DOCKER_FILE, DOCKER_IMAGE]
|
||||
cmds:
|
||||
- docker build -t {{.DOCKER_IMAGE}}:latest -f {{.DOCKER_FILE}} .
|
||||
- docker build -t {{.DOCKER_IMAGE}}:{{.COMMIT}} -f {{.DOCKER_FILE}} .
|
||||
- docker push {{.DOCKER_IMAGE}}:latest
|
||||
- docker push {{.DOCKER_IMAGE}}:{{.COMMIT}}
|
26
.github/taskfiles/Dokku.yml
vendored
Normal file
26
.github/taskfiles/Dokku.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
logi-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l info {{.TEXT}}
|
||||
|
||||
logw-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l warn {{.TEXT}}
|
||||
|
||||
loge-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l error {{.TEXT}}
|
||||
|
||||
logd-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l debug {{.TEXT}}
|
29
.github/taskfiles/Doppler.yml
vendored
Normal file
29
.github/taskfiles/Doppler.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
GOPATH:
|
||||
sh: go env GOPATH
|
||||
BIN_DIR: "{{.GOPATH}}/bin"
|
||||
OS:
|
||||
sh: uname -s
|
||||
ARCH:
|
||||
sh: uname -m
|
||||
|
||||
tasks:
|
||||
init-pkl:
|
||||
desc: Configure synapse homeserver with PKL
|
||||
silent: true
|
||||
cmds:
|
||||
- pkl eval pkl/matrix.net/Homeserver.pkl -f yaml -o deploy/conf/synapse/homeserver.yaml
|
||||
env:
|
||||
MATRIX_CLIENT_NAME: sonr.id
|
||||
MATRIX_SERVER_NAME: sonr.id
|
||||
MATRIX_SERVER_URL: http://localhost:8008
|
||||
MATRIX_SLIDING_SYNC_PROXY: http://localhost:8008
|
||||
MATRIX_PSQL_CONN: postgresql://matrixhs_user:matrixhs_password123@localhost:5432/sonr
|
||||
MATRIX_REGISTRATION_SHARED_SECRET: secret
|
||||
MATRIX_ENABLE_RECATCHA: false
|
||||
MATRIX_RECATCHA_PUBLIC_KEY: ""
|
||||
MATRIX_RECATCHA_PRIVATE_KEY: ""
|
||||
MATRIX_RECATCHA_BYPASS_SECRET: ""
|
||||
|
26
.github/taskfiles/Gh.yml
vendored
Normal file
26
.github/taskfiles/Gh.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
logi-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l info {{.TEXT}}
|
||||
|
||||
logw-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l warn {{.TEXT}}
|
||||
|
||||
loge-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l error {{.TEXT}}
|
||||
|
||||
logd-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l debug {{.TEXT}}
|
34
.github/taskfiles/Go.yml
vendored
Normal file
34
.github/taskfiles/Go.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
BINARY: sonrd
|
||||
BUILD_FLAGS: -mod=readonly -trimpath
|
||||
BUILD_TAGS: netgo,ledger
|
||||
COMMIT:
|
||||
sh: git rev-parse HEAD
|
||||
VERSION:
|
||||
sh: git describe --tags --always
|
||||
|
||||
tasks:
|
||||
build:
|
||||
desc: Build the sonrd binary
|
||||
cmds:
|
||||
- >
|
||||
go build
|
||||
{{.BUILD_FLAGS}}
|
||||
-tags "{{.BUILD_TAGS}}"
|
||||
-ldflags "
|
||||
-X github.com/cosmos/cosmos-sdk/version.Name=sonr
|
||||
-X github.com/cosmos/cosmos-sdk/version.AppName=sonrd
|
||||
-X github.com/cosmos/cosmos-sdk/version.Version={{.VERSION}}
|
||||
-X github.com/cosmos/cosmos-sdk/version.Commit={{.COMMIT}}
|
||||
-X github.com/cosmos/cosmos-sdk/version.BuildTags={{.BUILD_TAGS}}
|
||||
"
|
||||
-o ./build/{{.BINARY}}
|
||||
./cmd/sonrd
|
||||
env:
|
||||
CGO_ENABLED: 1
|
||||
GOARCH:
|
||||
sh: go env GOARCH
|
||||
GOOS:
|
||||
sh: go env GOOS
|
27
.github/taskfiles/Goreleaser.yml
vendored
Normal file
27
.github/taskfiles/Goreleaser.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
GOPATH:
|
||||
sh: go env GOPATH
|
||||
OS:
|
||||
sh: uname -s
|
||||
ARCH:
|
||||
sh: uname -m
|
||||
|
||||
tasks:
|
||||
install-go:
|
||||
desc: Install go dependencies
|
||||
silent: true
|
||||
vars:
|
||||
DEPS:
|
||||
[
|
||||
"github.com/apple/pkl-go/cmd/pkl-gen-go@latest",
|
||||
"github.com/sqlc-dev/sqlc/cmd/sqlc@latest",
|
||||
"github.com/goreleaser/goreleaser/v2@latest",
|
||||
"github.com/a-h/templ/cmd/templ@latest",
|
||||
]
|
||||
cmds:
|
||||
- for: { var: DEPS }
|
||||
cmd: gum spin --spinner dot --title "Installing go dependencies..." -- go install {{.ITEM}}
|
||||
|
||||
|
26
.github/taskfiles/Log.yml
vendored
Normal file
26
.github/taskfiles/Log.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
info-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l info {{.TEXT}}
|
||||
|
||||
warn-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l warn {{.TEXT}}
|
||||
|
||||
error-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l error {{.TEXT}}
|
||||
|
||||
debug-*:
|
||||
vars:
|
||||
TEXT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- gum log -l debug {{.TEXT}}
|
58
.github/taskfiles/Pkl.yml
vendored
Normal file
58
.github/taskfiles/Pkl.yml
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
PROXY: package://pkg.pkl-lang.org/pkl-pantry
|
||||
NAME: org.json_schema.contrib
|
||||
VERSION: 1.1.3
|
||||
PKG: "{{.PROXY}}/{{.NAME}}@{{.VERSION}}#"
|
||||
ROOT_DIR:
|
||||
sh: git rev-parse --show-toplevel
|
||||
|
||||
tasks:
|
||||
jsonpkl-*:
|
||||
dir: '{{.ROOT_DIR}}'
|
||||
vars:
|
||||
FILE: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- task: schemagen-{{.FILE}}
|
||||
- task: gojson-{{.FILE}}
|
||||
|
||||
pkljson-*:
|
||||
dir: '{{.ROOT_DIR}}'
|
||||
vars:
|
||||
INPUT: '{{index .MATCH 0}}'
|
||||
cmds:
|
||||
- pkl eval {{.PKG}}/generate.pkl -m . -p source=types/schemas/{{.INPUT}}
|
||||
- mv *.pkl pkl/
|
||||
|
||||
gojson-*:
|
||||
dir: '{{.ROOT_DIR}}'
|
||||
vars:
|
||||
INPUT: '{{index .MATCH 0}}'
|
||||
GOOUT:
|
||||
sh: echo {{.INPUT}} | sed 's/\.json//'
|
||||
FLAGS: --schema-output=http://json-schema.org/draft-04/schema#=internal/models/{{.GOOUT}}.go --schema-package=http://json-schema.org/draft-04/schema#=github.com/prnk28/gh-pm
|
||||
cmds:
|
||||
- go-jsonschema {{.FLAGS}} -p models types/schemas/{{.INPUT}} > internal/models/{{.GOOUT}}.go
|
||||
|
||||
schemagen-*:
|
||||
dir: '{{.ROOT_DIR}}'
|
||||
vars:
|
||||
INPUT: '{{index .MATCH 0}}'
|
||||
OUTPUT:
|
||||
sh: basename {{.INPUT}}
|
||||
cmds:
|
||||
- mkdir -p types/schemas
|
||||
- json-schema-generator -f types/base/{{.INPUT}} -o types/schemas/{{.OUTPUT}}
|
||||
|
||||
fetch-data:
|
||||
dir: '{{.ROOT_DIR}}'
|
||||
cmds:
|
||||
- mkdir -p types/base
|
||||
- gh project item-list 4 --owner coindotfi --format json --jq .items > types/base/cards.json
|
||||
- gh issue ls --repo=coindotfi/coind --json author,assignees,body,id,labels,milestone,number,projectCards,projectItems,state,stateReason,title,url > types/base/issues.json
|
||||
- gh project ls --owner=coindotfi --format json --jq .projects > types/base/projects.json
|
||||
- gh api user > types/base/user.json
|
||||
- gh pr ls --json "id" --json "title" --json "headRefName" --json "createdAt" --json "author" --json "number" > types/base/prs.json
|
||||
- gh release list --repo onsonr/sonr --json "name" --json "tagName" --json "publishedAt" --json "isDraft" --json "isLatest" > types/base/releases.json
|
||||
- gh milestone ls --repo onsonr/sonr --state all --json title,number,url,id,progressPercentage,state | sed 's/\[onsonr\/sonr onsonr sonr\]//' | tee types/base/milestones.json
|
34
.github/taskfiles/Templ.yaml
vendored
Normal file
34
.github/taskfiles/Templ.yaml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
GOPATH:
|
||||
sh: go env GOPATH
|
||||
BIN_DIR: "{{.GOPATH}}/bin"
|
||||
BINARY: "{{.BIN_DIR}}/hway"
|
||||
OS:
|
||||
sh: uname -s
|
||||
ARCH:
|
||||
sh: uname -m
|
||||
|
||||
tasks:
|
||||
build:
|
||||
desc: Build the hway binary
|
||||
silent: true
|
||||
cmds:
|
||||
- templ generate
|
||||
- sqlc generate -f internal/database/sqlc.yaml
|
||||
- gum spin --spinner dot --title "Build Hway Single Target ({{.OS}}/{{.ARCH}})..." -- goreleaser build --snapshot --clean --single-target --id hway -o {{.BIN_DIR}}/hway
|
||||
|
||||
install:
|
||||
desc: Install the hway binary
|
||||
silent: true
|
||||
cmds:
|
||||
- templ generate
|
||||
- sqlc generate -f internal/database/sqlc.yaml
|
||||
- gum spin --spinner dot --title "Install Hway Single Target ({{.OS}}/{{.ARCH}})..." -- make install-hway
|
||||
|
||||
start:
|
||||
desc: Start the hway daemon
|
||||
silent: true
|
||||
cmds:
|
||||
- "{{.BINARY}}"
|
50
.github/taskfiles/Wrangler.yml
vendored
Normal file
50
.github/taskfiles/Wrangler.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
ROOT:
|
||||
sh: git rev-parse --show-toplevel
|
||||
tasks:
|
||||
init:
|
||||
desc: Setup ipfs with Cloudflare
|
||||
silent: true
|
||||
vars:
|
||||
PEERS: |
|
||||
'[
|
||||
{"ID": "QmcFf2FH3CEgTNHeMRGhN7HNHU1EXAxoEk6EFuSyXCsvRE", "Addrs": ["/dnsaddr/node-1.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcFmLd5ySfk2WZuJ1mfSWLDjdmHZq7rSAua4GoeSQfs1z", "Addrs": ["/dnsaddr/node-2.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcfFmzSDVbwexQ9Au2pt5YEXHK5xajwgaU6PpkbLWerMa", "Addrs": ["/dnsaddr/node-3.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcfJeB3Js1FG7T8YaZATEiaHqNKVdQfybYYkbT1knUswx", "Addrs": ["/dnsaddr/node-4.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcfVvzK4tMdFmpJjEKDUoqRgP4W9FnmJoziYX5GXJJ8eZ", "Addrs": ["/dnsaddr/node-5.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcfZD3VKrUxyP9BbyUnZDpbqDnT7cQ4WjPP8TRLXaoE7G", "Addrs": ["/dnsaddr/node-6.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcfZP2LuW4jxviTeG8fi28qjnZScACb8PEgHAc17ZEri3", "Addrs": ["/dnsaddr/node-7.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcfgsJsMtx6qJb74akCw1M24X1zFwgGo11h1cuhwQjtJP", "Addrs": ["/dnsaddr/node-8.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "Qmcfr2FC7pFzJbTSDfYaSy1J8Uuy8ccGLeLyqJCKJvTHMi", "Addrs": ["/dnsaddr/node-9.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcfR3V5YAtHBzxVACWCzXTt26SyEkxdwhGJ6875A8BuWx", "Addrs": ["/dnsaddr/node-10.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "Qmcfuo1TM9uUiJp6dTbm915Rf1aTqm3a3dnmCdDQLHgvL5", "Addrs": ["/dnsaddr/node-11.ingress.cloudflare-ipfs.com"]},
|
||||
{"ID": "QmcfV2sg9zaq7UUHVCGuSvT2M2rnLBAPsiE79vVyK3Cuev", "Addrs": ["/dnsaddr/node-12.ingress.cloudflare-ipfs.com"]}
|
||||
]'
|
||||
cmds:
|
||||
- rm -rf ~/.ipfs
|
||||
- ipfs init
|
||||
- ipfs config --json Peering.Peers {{.PEERS}}
|
||||
- ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
|
||||
|
||||
mount:
|
||||
desc: Mount the ipfs,ipns directories
|
||||
silent: true
|
||||
platforms:
|
||||
- linux
|
||||
cmds:
|
||||
- ipfs config --json Mounts.FuseAllowOther true
|
||||
|
||||
start:
|
||||
desc: Start the ipfs daemon
|
||||
silent: true
|
||||
cmds:
|
||||
- cmd: ipfs daemon --migrate
|
||||
platforms:
|
||||
- darwin
|
||||
- task: mount
|
||||
- cmd: ipfs daemon --mount
|
||||
platforms:
|
||||
- linux
|
23
Taskfile.yml
Normal file
23
Taskfile.yml
Normal file
@ -0,0 +1,23 @@
|
||||
version: '3'
|
||||
includes:
|
||||
buf: .github/taskfiles/Buf.yml
|
||||
bun: .github/taskfiles/Bun.yml
|
||||
docker: .github/taskfiles/Docker.yml
|
||||
dokku: .github/taskfiles/Dokku.yml
|
||||
doppler: .github/taskfiles/Doppler.yml
|
||||
gh: .github/taskfiles/Gh.yml
|
||||
go: .github/taskfiles/Go.yml
|
||||
goreleaser: .github/taskfiles/Goreleaser.yml
|
||||
log: .github/taskfiles/Log.yml
|
||||
pkl: .github/taskfiles/Pkl.yml
|
||||
templ: .github/taskfiles/Templ.yaml
|
||||
wrangler: .github/taskfiles/Wrangler.yml
|
||||
|
||||
silent: true
|
||||
vars:
|
||||
GREETING: Hello, World!
|
||||
|
||||
tasks:
|
||||
default:
|
||||
cmds:
|
||||
- echo "{{.GREETING}}"
|
Loading…
x
Reference in New Issue
Block a user