2022-05-02 19:04:45 +00:00
|
|
|
.DEFAULT_GOAL := build
|
|
|
|
|
2022-02-11 04:32:00 +00:00
|
|
|
INSTALL_DIR=$(shell go env GOPATH)/bin
|
2022-02-28 17:16:44 +00:00
|
|
|
GOOS=$(shell go env GOOS)
|
|
|
|
GOARCH=$(shell go env GOARCH)
|
2022-02-11 04:32:00 +00:00
|
|
|
|
2022-05-04 14:47:48 +00:00
|
|
|
bin: $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum
|
2022-05-02 19:04:45 +00:00
|
|
|
@echo "== This builds binaries for command-line usage."
|
|
|
|
@echo "== Use \"make build\" to embed the site."
|
|
|
|
goreleaser build --snapshot --rm-dist --single-target
|
|
|
|
|
|
|
|
build: dist/artifacts.json
|
2022-01-18 21:13:19 +00:00
|
|
|
.PHONY: build
|
|
|
|
|
2022-01-05 15:20:56 +00:00
|
|
|
# Runs migrations to output a dump of the database.
|
2022-03-25 21:07:45 +00:00
|
|
|
coderd/database/dump.sql: $(wildcard coderd/database/migrations/*.sql)
|
|
|
|
go run coderd/database/dump/main.go
|
2022-01-05 15:20:56 +00:00
|
|
|
|
|
|
|
# Generates Go code for querying the database.
|
2022-05-02 18:23:13 +00:00
|
|
|
coderd/database/querier.go: coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql)
|
2022-04-01 20:45:23 +00:00
|
|
|
coderd/database/generate.sh
|
2022-01-05 15:20:56 +00:00
|
|
|
|
2022-05-18 16:00:20 +00:00
|
|
|
dev:
|
2022-05-17 18:12:14 +00:00
|
|
|
./scripts/develop.sh
|
|
|
|
.PHONY: dev
|
|
|
|
|
2022-05-04 14:47:48 +00:00
|
|
|
dist/artifacts.json: site/out/index.html $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum
|
2022-05-02 19:04:45 +00:00
|
|
|
goreleaser release --snapshot --rm-dist --skip-sign
|
2022-04-19 00:45:22 +00:00
|
|
|
|
2022-01-04 02:54:27 +00:00
|
|
|
fmt/prettier:
|
|
|
|
@echo "--- prettier"
|
|
|
|
# Avoid writing files in CI to reduce file write activity
|
|
|
|
ifdef CI
|
2022-02-01 21:34:43 +00:00
|
|
|
cd site && yarn run format:check
|
2022-01-04 02:54:27 +00:00
|
|
|
else
|
2022-02-01 21:34:43 +00:00
|
|
|
cd site && yarn run format:write
|
2022-01-04 02:54:27 +00:00
|
|
|
endif
|
|
|
|
.PHONY: fmt/prettier
|
|
|
|
|
2022-04-11 21:06:15 +00:00
|
|
|
fmt/terraform: $(wildcard *.tf)
|
|
|
|
terraform fmt -recursive
|
2022-05-02 19:04:45 +00:00
|
|
|
.PHONY: fmt/terraform
|
2022-04-11 21:06:15 +00:00
|
|
|
|
2022-04-22 20:27:55 +00:00
|
|
|
fmt: fmt/prettier fmt/terraform
|
2022-01-05 15:20:56 +00:00
|
|
|
.PHONY: fmt
|
2022-01-08 17:24:02 +00:00
|
|
|
|
2022-05-02 18:23:13 +00:00
|
|
|
gen: coderd/database/querier.go peerbroker/proto/peerbroker.pb.go provisionersdk/proto/provisioner.pb.go provisionerd/proto/provisionerd.pb.go site/src/api/typesGenerated.ts
|
2022-01-08 17:24:02 +00:00
|
|
|
|
2022-04-25 20:24:23 +00:00
|
|
|
install: build
|
2022-02-11 04:32:00 +00:00
|
|
|
@echo "--- Copying from bin to $(INSTALL_DIR)"
|
2022-04-22 20:41:45 +00:00
|
|
|
cp -r ./dist/coder-$(GOOS)_$(GOOS)_$(GOARCH)*/* $(INSTALL_DIR)
|
2022-02-11 04:32:00 +00:00
|
|
|
@echo "-- CLI available at $(shell ls $(INSTALL_DIR)/coder*)"
|
|
|
|
.PHONY: install
|
|
|
|
|
2022-03-28 20:21:00 +00:00
|
|
|
lint:
|
|
|
|
golangci-lint run
|
|
|
|
.PHONY: lint
|
|
|
|
|
2022-05-02 18:23:13 +00:00
|
|
|
peerbroker/proto/peerbroker.pb.go: peerbroker/proto/peerbroker.proto
|
2022-01-29 23:52:14 +00:00
|
|
|
protoc \
|
2022-01-11 15:28:41 +00:00
|
|
|
--go_out=. \
|
|
|
|
--go_opt=paths=source_relative \
|
|
|
|
--go-drpc_out=. \
|
|
|
|
--go-drpc_opt=paths=source_relative \
|
2022-01-29 23:52:14 +00:00
|
|
|
./peerbroker/proto/peerbroker.proto
|
2022-01-11 15:28:41 +00:00
|
|
|
|
2022-05-02 18:23:13 +00:00
|
|
|
provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
|
2022-01-29 23:52:14 +00:00
|
|
|
protoc \
|
|
|
|
--go_out=. \
|
|
|
|
--go_opt=paths=source_relative \
|
|
|
|
--go-drpc_out=. \
|
|
|
|
--go-drpc_opt=paths=source_relative \
|
|
|
|
./provisionerd/proto/provisionerd.proto
|
|
|
|
|
2022-05-02 18:23:13 +00:00
|
|
|
provisionersdk/proto/provisioner.pb.go: provisionersdk/proto/provisioner.proto
|
2022-01-29 23:52:14 +00:00
|
|
|
protoc \
|
2022-01-08 17:24:02 +00:00
|
|
|
--go_out=. \
|
|
|
|
--go_opt=paths=source_relative \
|
|
|
|
--go-drpc_out=. \
|
|
|
|
--go-drpc_opt=paths=source_relative \
|
2022-01-29 23:52:14 +00:00
|
|
|
./provisionersdk/proto/provisioner.proto
|
2022-01-18 21:13:19 +00:00
|
|
|
|
2022-05-04 14:47:48 +00:00
|
|
|
site/out/index.html: $(shell find ./site -not -path './site/node_modules/*' -type f -name '*.tsx') $(shell find ./site -not -path './site/node_modules/*' -type f -name '*.ts') site/package.json
|
2022-02-20 19:52:14 +00:00
|
|
|
./scripts/yarn_install.sh
|
2022-03-18 18:07:08 +00:00
|
|
|
cd site && yarn typegen
|
2022-02-01 21:34:43 +00:00
|
|
|
cd site && yarn build
|
2022-03-08 01:50:37 +00:00
|
|
|
# Restores GITKEEP files!
|
|
|
|
git checkout HEAD site/out
|
2022-05-02 18:23:13 +00:00
|
|
|
|
2022-05-10 07:44:09 +00:00
|
|
|
site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find codersdk -type f -name '*.go')
|
2022-05-02 18:23:13 +00:00
|
|
|
go run scripts/apitypings/main.go > site/src/api/typesGenerated.ts
|
|
|
|
cd site && yarn run format:types
|
2022-03-28 19:14:40 +00:00
|
|
|
|
2022-03-28 20:21:00 +00:00
|
|
|
test:
|
|
|
|
gotestsum -- -v -short ./...
|