Skip to content

Commit

Permalink
Feat: first commit for v3
Browse files Browse the repository at this point in the history
- moved to multi package repo
- reduced dependencies
- dropped support for script and validation directives
- work in progress
  • Loading branch information
dosco committed Jan 25, 2023
1 parent 96f69c5 commit 062b181
Show file tree
Hide file tree
Showing 204 changed files with 3,203 additions and 3,280 deletions.
49 changes: 0 additions & 49 deletions .chglog/CHANGELOG.tpl.md

This file was deleted.

27 changes: 0 additions & 27 deletions .chglog/config.yml

This file was deleted.

19 changes: 5 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=10m -v
- name: Linter
run: make build

releaser:
needs: linter
Expand All @@ -45,7 +42,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.18.3"
go-version: "1.19"

- name: Cache Go modules
uses: actions/cache@v3
Expand All @@ -55,14 +52,8 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Run Postgres Tests
run: go test -v -timeout 30m -race ./...

- name: Run MySQL Tests
working-directory: ./core
run: |
go test -v -timeout 30m -db=mysql -tags=mysql -race -run=Example_query ./...
go test -v -timeout 30m -db=mysql -tags=mysql -race -run=Example_sub ./...
- name: Run Tests
run: make test

- name: Snapcraft Login
if: success() && startsWith(github.ref, 'refs/tags/v')
Expand Down
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ before:
- go mod download
- make gen
builds:
- env:
- main: ./cmd
env:
- CGO_ENABLED=0
goos:
- linux
Expand Down
20 changes: 8 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ BUILD_VERSION ?= $(shell git describe --always --tags)
GOPATH ?= $(shell go env GOPATH)
GOROOT ?= $(shell go env GOROOT)

PACKAGES ?= core tests plugin/afero plugin/osfs plugin/otel plugin/wasm serv auth cmd

ifndef GOPATH
override GOPATH = $(HOME)/go
endif
Expand All @@ -21,8 +23,8 @@ tidy:
@go mod tidy -go=1.16 && go mod tidy -go=1.17

test:
@go test -v -timeout 50m -race ./...
@cd core; go test -v -timeout 50m -race -db=mysql -tags=mysql ./...
@cd tests; go test -v -timeout 30m -race ./...
@cd tests; go test -v -timeout 30m -race -db=mysql -tags=mysql ./...

test-norace:
@go test -v -timeout 50m ./... && go test -v -timeout 50m -db=mysql -tags=mysql ./...
Expand All @@ -33,7 +35,6 @@ WEB_BUILD_DIR := ./serv/web/build/manifest.json
# @echo Installing tools from tools.go
# @cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
download-tools:
@go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@go install golang.org/x/perf/cmd/benchstat@latest
@go install golang.org/x/tools/cmd/stringer@latest
Expand All @@ -43,11 +44,8 @@ $(WEB_BUILD_DIR):
@echo "Run this command: yarn --cwd serv/web/ build"
@exit 1

changelog: download-tools
@git-chglog $(ARGS)

lint: download-tools
@golangci-lint run ./...
@golangci-lint run $(PACKAGES)

BINARY := graphjin
WASM := ./wasm/graphjin.wasm
Expand All @@ -74,8 +72,7 @@ gen: download-tools
@go generate ./...

$(BINARY):
@CGO_ENABLED=0 go build $(BUILD_FLAGS) -o $(BINARY) main.go

@CGO_ENABLED=0 go build $(BUILD_FLAGS) -o $(BINARY) cmd/*.go
$(WASM):
@cp $(GOROOT)/misc/wasm/wasm_exec.js ./wasm/js/
@GOOS=js GOARCH=wasm go build -o ./wasm/graphjin.wasm ./wasm/*.go
Expand All @@ -85,7 +82,7 @@ clean:
@rm -f $(WASM)

run: clean
@go run $(BUILD_FLAGS) main.go $(ARGS)
@go run $(BUILD_FLAGS) cmd/*.go $(ARGS)

run-github-actions:
@act push --job linter
Expand Down Expand Up @@ -117,6 +114,5 @@ help:
@echo " make run - Run graphjin (eg. make run ARGS=\"help\")"
@echo " make test - Run all tests"
@echo " make run-github-actions - Run Github Actions locally (brew install act)"
@echo " make changelog - Generate changelog (eg. make changelog ARGS=\"help\")"
@echo " make help - This help"
@echo
@echo
8 changes: 4 additions & 4 deletions serv/auth/auth.go → auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"net/http"
"path/filepath"
"github.com/go-chi/chi"
"github.com/dosco/graphjin/v2/serv"
"github.com/dosco/graphjin/v2/serv/auth"
"github.com/dosco/graphjin/serv/v3"
"github.com/dosco/graphjin/auth/v3"
)
func main() {
Expand Down Expand Up @@ -40,12 +40,12 @@ import (
"net/http"
"strconv"

core "github.com/dosco/graphjin/v2/core"
"github.com/dosco/graphjin/core/v3"
"github.com/gorilla/websocket"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

"github.com/dosco/graphjin/v2/serv/auth/provider"
"github.com/dosco/graphjin/auth/v3/provider"
)

type JWTConfig = provider.JWTConfig
Expand Down
2 changes: 1 addition & 1 deletion serv/auth/auth_test.go → auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
"testing"

"github.com/dosco/graphjin/v2/serv/auth"
"github.com/dosco/graphjin/auth/v3"
"github.com/stretchr/testify/assert"
)

Expand Down
46 changes: 46 additions & 0 deletions auth/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module github.com/dosco/graphjin/auth/v3

go 1.18

replace github.com/dosco/graphjin/core/v3 => ../core

replace github.com/dosco/graphjin/plugin/osfs/v3 => ../plugin/osfs

require (
github.com/adjust/gorails v0.0.0-20171013043634-2786ed0c03d3
github.com/bradfitz/gomemcache v0.0.0-20230124162541-5f7a7d875746
github.com/dosco/graphjin/core/v3 v3.0.0-00010101000000-000000000000
github.com/dosco/graphjin/plugin/osfs/v3 v3.0.0-00010101000000-000000000000
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/gomodule/redigo v1.8.9
github.com/gorilla/websocket v1.5.0
github.com/lestrrat-go/jwx v1.2.25
github.com/stretchr/testify v1.8.1
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.5.0
)

require (
github.com/avast/retry-go v3.0.0+incompatible // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/rs/xid v1.4.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/text v0.6.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

1 comment on commit 062b181

@vercel
Copy link

@vercel vercel bot commented on 062b181 Jan 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.