-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
58 lines (48 loc) · 2.22 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
GOFMT_FILES?=$$(find . -name '*.go')
all: fmt build install
fmt:
gofmt -w $(GOFMT_FILES)
build: fmt
go build -ldflags "-X github.com/swiftcarrot/queryx/cmd/queryx/action.Version=`git rev-parse HEAD`" -o bin/queryx cmd/queryx/main.go
install: build
sudo install bin/queryx /usr/local/bin
clean:
rm bin/queryx
test-postgresql: install
rm -rf internal/integration/db
cd internal/integration && queryx db:drop --schema postgresql.hcl
cd internal/integration && queryx db:create --schema postgresql.hcl
cd internal/integration && queryx db:migrate --schema postgresql.hcl
cd internal/integration && queryx db:migrate --schema postgresql.hcl
cd internal/integration && queryx generate --schema postgresql.hcl
# cd internal/integration && yarn tsc
cd internal/integration && yarn test
cd internal/integration && go test ./...
# cd internal/integration && queryx db:drop --schema postgresql.hcl
test-mysql: install
rm -rf internal/integration/db
cd internal/integration && queryx db:drop --schema mysql.hcl
cd internal/integration && queryx db:create --schema mysql.hcl
cd internal/integration && queryx db:migrate --schema mysql.hcl
cd internal/integration && queryx db:migrate --schema mysql.hcl
cd internal/integration && queryx generate --schema mysql.hcl
# cd internal/integration && yarn tsc
cd internal/integration && yarn test
# cd internal/integration && go test ./...
test-sqlite: install
rm -rf internal/integration/db
cd internal/integration && queryx db:drop --schema sqlite.hcl
cd internal/integration && queryx db:create --schema sqlite.hcl
cd internal/integration && queryx db:migrate --schema sqlite.hcl
cd internal/integration && queryx db:migrate --schema sqlite.hcl
cd internal/integration && queryx generate --schema sqlite.hcl
# cd internal/integration && yarn tsc
cd internal/integration && yarn test
cd internal/integration && go test ./...
test: test-postgresql test-sqlite test-mysql
test-migrate: install
rm -rf internal/migrate/db internal/migrate/test.sqlite3
cd internal/migrate && queryx db:migrate --schema sqlite1.hcl
sleep 1
cd internal/migrate && queryx db:migrate --schema sqlite2.hcl
cd internal/migrate && sqlite3 test.sqlite3 "insert into users(name, email) values('test', 'test@example.com')"