2022-02-03 00:20:34 +00:00
|
|
|
IS_WIN_SHELL =
|
2020-06-22 23:51:57 +00:00
|
|
|
ifeq (${SHELL}, sh.exe)
|
2022-02-03 00:20:34 +00:00
|
|
|
IS_WIN_SHELL = true
|
2020-06-22 23:51:57 +00:00
|
|
|
endif
|
|
|
|
ifeq (${SHELL}, cmd)
|
2022-02-03 00:20:34 +00:00
|
|
|
IS_WIN_SHELL = true
|
2020-06-22 23:51:57 +00:00
|
|
|
endif
|
|
|
|
|
2022-02-03 00:20:34 +00:00
|
|
|
ifdef IS_WIN_SHELL
|
2023-03-01 04:09:28 +00:00
|
|
|
RM := del /s /q
|
|
|
|
RMDIR := rmdir /s /q
|
2023-11-28 02:56:46 +00:00
|
|
|
NOOP := @@
|
Add golangci-lint workflow (#1759)
* Add golangci-lint workflow
* Add a bit more lenient linter timeout
1 Minute isn't always enough, so bump to 3.
* Document golangci, add make target
Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.
* Introduce .golangci.yml
This is the default golangci-lint configuration file location. Use it.
Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.
* Add gofmt and revive to golangci-lint
Read the golangci-lint source code to figure out the configuration format.
Copy the configuration from `revive.toml` into the linter configuration.
* Do not set simplify on gofmt
The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.
* Add new-from-rev
Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.
Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.
* Move to golangci-lint
Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.
Use the frontend build steps in build.yml
Update README to reflect the new world order.
* Remove check-gofmt.sh
The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.
* Remove targets for golangci-lint
Fold these targets into the `lint` target. While here, update README.
2021-09-27 00:41:59 +00:00
|
|
|
else
|
2023-03-01 04:09:28 +00:00
|
|
|
RM := rm -f
|
|
|
|
RMDIR := rm -rf
|
2023-11-28 02:56:46 +00:00
|
|
|
NOOP := @:
|
2019-07-28 03:19:54 +00:00
|
|
|
endif
|
|
|
|
|
2020-06-29 04:44:21 +00:00
|
|
|
# set LDFLAGS environment variable to any extra ldflags required
|
|
|
|
LDFLAGS := $(LDFLAGS)
|
2023-07-11 01:36:57 +00:00
|
|
|
|
|
|
|
# set OUTPUT environment variable to generate a specific binary name
|
2023-07-12 00:05:35 +00:00
|
|
|
# this will apply to both `stash` and `phasher`, so build them separately
|
|
|
|
# alternatively use STASH_OUTPUT or PHASHER_OUTPUT to set the value individually
|
2020-06-29 04:44:21 +00:00
|
|
|
ifdef OUTPUT
|
2023-07-12 00:05:35 +00:00
|
|
|
STASH_OUTPUT := $(OUTPUT)
|
|
|
|
PHASHER_OUTPUT := $(OUTPUT)
|
|
|
|
endif
|
|
|
|
ifdef STASH_OUTPUT
|
|
|
|
STASH_OUTPUT := -o $(STASH_OUTPUT)
|
|
|
|
endif
|
|
|
|
ifdef PHASHER_OUTPUT
|
|
|
|
PHASHER_OUTPUT := -o $(PHASHER_OUTPUT)
|
2020-06-29 04:44:21 +00:00
|
|
|
endif
|
|
|
|
|
2023-07-11 01:36:57 +00:00
|
|
|
# set GO_BUILD_FLAGS environment variable to any extra build flags required
|
|
|
|
GO_BUILD_FLAGS := $(GO_BUILD_FLAGS)
|
2021-05-16 09:19:56 +00:00
|
|
|
|
2023-07-11 01:36:57 +00:00
|
|
|
# set GO_BUILD_TAGS environment variable to any extra build tags required
|
|
|
|
GO_BUILD_TAGS := $(GO_BUILD_TAGS)
|
2023-11-02 05:13:56 +00:00
|
|
|
GO_BUILD_TAGS += sqlite_stat4 sqlite_math_functions
|
2022-11-22 22:10:39 +00:00
|
|
|
|
2023-04-19 01:59:56 +00:00
|
|
|
# set STASH_NOLEGACY environment variable or uncomment to disable legacy browser support
|
|
|
|
# STASH_NOLEGACY := true
|
|
|
|
|
|
|
|
# set STASH_SOURCEMAPS environment variable or uncomment to enable UI sourcemaps
|
|
|
|
# STASH_SOURCEMAPS := true
|
2020-06-29 04:44:21 +00:00
|
|
|
|
2023-07-11 01:36:57 +00:00
|
|
|
export CGO_ENABLED := 1
|
|
|
|
|
2024-02-16 01:39:45 +00:00
|
|
|
# define COMPILER_IMAGE for cross-compilation docker container
|
|
|
|
ifndef COMPILER_IMAGE
|
|
|
|
COMPILER_IMAGE := stashapp/compiler:latest
|
|
|
|
endif
|
|
|
|
|
2023-04-19 01:59:56 +00:00
|
|
|
.PHONY: release
|
2022-10-25 22:18:02 +00:00
|
|
|
release: pre-ui generate ui build-release
|
2019-12-28 17:53:16 +00:00
|
|
|
|
2023-07-12 00:05:35 +00:00
|
|
|
# targets to set various build flags
|
2023-11-18 23:36:13 +00:00
|
|
|
# use combinations on the make command-line to configure a build, e.g.:
|
|
|
|
# for a static-pie release build: `make flags-static-pie flags-release stash`
|
|
|
|
# for a static windows debug build: `make flags-static-windows stash`
|
|
|
|
|
2023-11-28 02:56:46 +00:00
|
|
|
# $(NOOP) prevents "nothing to be done" warnings
|
2023-07-12 00:05:35 +00:00
|
|
|
|
|
|
|
.PHONY: flags-release
|
2023-11-28 02:56:46 +00:00
|
|
|
flags-release:
|
|
|
|
$(NOOP)
|
2023-07-12 00:05:35 +00:00
|
|
|
$(eval LDFLAGS += -s -w)
|
|
|
|
$(eval GO_BUILD_FLAGS += -trimpath)
|
|
|
|
|
|
|
|
.PHONY: flags-pie
|
2023-11-28 02:56:46 +00:00
|
|
|
flags-pie:
|
|
|
|
$(NOOP)
|
2023-07-12 00:05:35 +00:00
|
|
|
$(eval GO_BUILD_FLAGS += -buildmode=pie)
|
|
|
|
|
|
|
|
.PHONY: flags-static
|
2023-11-28 02:56:46 +00:00
|
|
|
flags-static:
|
|
|
|
$(NOOP)
|
2023-07-12 00:05:35 +00:00
|
|
|
$(eval LDFLAGS += -extldflags=-static)
|
|
|
|
$(eval GO_BUILD_TAGS += sqlite_omit_load_extension osusergo netgo)
|
|
|
|
|
|
|
|
.PHONY: flags-static-pie
|
2023-11-28 02:56:46 +00:00
|
|
|
flags-static-pie:
|
|
|
|
$(NOOP)
|
2023-07-12 00:05:35 +00:00
|
|
|
$(eval LDFLAGS += -extldflags=-static-pie)
|
|
|
|
$(eval GO_BUILD_FLAGS += -buildmode=pie)
|
|
|
|
$(eval GO_BUILD_TAGS += sqlite_omit_load_extension osusergo netgo)
|
|
|
|
|
2023-11-18 23:36:13 +00:00
|
|
|
# identical to flags-static-pie, but excluding netgo, which is not needed on windows
|
2023-07-12 00:05:35 +00:00
|
|
|
.PHONY: flags-static-windows
|
2023-11-28 02:56:46 +00:00
|
|
|
flags-static-windows:
|
|
|
|
$(NOOP)
|
2023-07-12 00:05:35 +00:00
|
|
|
$(eval LDFLAGS += -extldflags=-static-pie)
|
|
|
|
$(eval GO_BUILD_FLAGS += -buildmode=pie)
|
|
|
|
$(eval GO_BUILD_TAGS += sqlite_omit_load_extension osusergo)
|
|
|
|
|
|
|
|
.PHONY: build-info
|
|
|
|
build-info:
|
2020-06-29 04:44:21 +00:00
|
|
|
ifndef BUILD_DATE
|
2023-07-11 01:36:57 +00:00
|
|
|
$(eval BUILD_DATE := $(shell go run scripts/getDate.go))
|
2020-06-29 04:44:21 +00:00
|
|
|
endif
|
|
|
|
ifndef GITHASH
|
2019-10-16 22:46:16 +00:00
|
|
|
$(eval GITHASH := $(shell git rev-parse --short HEAD))
|
2020-06-29 04:44:21 +00:00
|
|
|
endif
|
|
|
|
ifndef STASH_VERSION
|
2020-02-06 19:39:08 +00:00
|
|
|
$(eval STASH_VERSION := $(shell git describe --tags --exclude latest_develop))
|
2020-06-29 04:44:21 +00:00
|
|
|
endif
|
2021-10-22 02:14:08 +00:00
|
|
|
ifndef OFFICIAL_BUILD
|
2022-11-22 22:10:39 +00:00
|
|
|
$(eval OFFICIAL_BUILD := false)
|
2021-10-22 02:14:08 +00:00
|
|
|
endif
|
|
|
|
|
2023-04-19 01:59:56 +00:00
|
|
|
.PHONY: build-flags
|
2023-07-12 00:05:35 +00:00
|
|
|
build-flags: build-info
|
2023-07-11 01:36:57 +00:00
|
|
|
$(eval BUILD_LDFLAGS := $(LDFLAGS))
|
2023-07-11 05:54:42 +00:00
|
|
|
$(eval BUILD_LDFLAGS += -X 'github.com/stashapp/stash/internal/build.buildstamp=$(BUILD_DATE)')
|
|
|
|
$(eval BUILD_LDFLAGS += -X 'github.com/stashapp/stash/internal/build.githash=$(GITHASH)')
|
|
|
|
$(eval BUILD_LDFLAGS += -X 'github.com/stashapp/stash/internal/build.version=$(STASH_VERSION)')
|
|
|
|
$(eval BUILD_LDFLAGS += -X 'github.com/stashapp/stash/internal/build.officialBuild=$(OFFICIAL_BUILD)')
|
2023-07-11 01:36:57 +00:00
|
|
|
$(eval BUILD_FLAGS := -v -tags "$(GO_BUILD_TAGS)" $(GO_BUILD_FLAGS) -ldflags "$(BUILD_LDFLAGS)")
|
|
|
|
|
2023-07-12 00:05:35 +00:00
|
|
|
.PHONY: stash
|
|
|
|
stash: build-flags
|
|
|
|
go build $(STASH_OUTPUT) $(BUILD_FLAGS) ./cmd/stash
|
|
|
|
|
2023-07-11 05:53:53 +00:00
|
|
|
.PHONY: phasher
|
2023-07-12 00:05:35 +00:00
|
|
|
phasher: build-flags
|
|
|
|
go build $(PHASHER_OUTPUT) $(BUILD_FLAGS) ./cmd/phasher
|
2023-07-11 05:53:53 +00:00
|
|
|
|
2023-07-12 00:05:35 +00:00
|
|
|
# builds dynamically-linked debug binaries
|
|
|
|
.PHONY: build
|
|
|
|
build: stash phasher
|
|
|
|
|
2023-11-18 23:36:13 +00:00
|
|
|
# builds dynamically-linked PIE release binaries
|
2023-04-19 01:59:56 +00:00
|
|
|
.PHONY: build-release
|
2023-11-18 23:36:13 +00:00
|
|
|
build-release: flags-release flags-pie build
|
|
|
|
|
|
|
|
# compile and bundle into Stash.app
|
|
|
|
# for when on macOS itself
|
|
|
|
.PHONY: stash-macapp
|
|
|
|
stash-macapp: STASH_OUTPUT := -o stash
|
|
|
|
stash-macapp: flags-release flags-pie stash
|
|
|
|
rm -rf Stash.app
|
|
|
|
cp -R scripts/macos-bundle Stash.app
|
|
|
|
mkdir Stash.app/Contents/MacOS
|
|
|
|
cp stash Stash.app/Contents/MacOS/stash
|
|
|
|
|
|
|
|
# build-cc- targets should be run within the compiler docker container
|
|
|
|
|
2023-12-14 02:29:44 +00:00
|
|
|
.PHONY: build-cc-windows
|
2023-11-18 23:36:13 +00:00
|
|
|
build-cc-windows: export GOOS := windows
|
|
|
|
build-cc-windows: export GOARCH := amd64
|
|
|
|
build-cc-windows: export CC := x86_64-w64-mingw32-gcc
|
|
|
|
build-cc-windows: STASH_OUTPUT := -o dist/stash-win.exe
|
|
|
|
build-cc-windows: PHASHER_OUTPUT :=-o dist/phasher-win.exe
|
|
|
|
build-cc-windows: flags-release
|
|
|
|
build-cc-windows: flags-static-windows
|
|
|
|
build-cc-windows: build
|
|
|
|
|
|
|
|
.PHONY: build-cc-macos-intel
|
|
|
|
build-cc-macos-intel: export GOOS := darwin
|
|
|
|
build-cc-macos-intel: export GOARCH := amd64
|
|
|
|
build-cc-macos-intel: export CC := o64-clang
|
|
|
|
build-cc-macos-intel: STASH_OUTPUT := -o dist/stash-macos-intel
|
|
|
|
build-cc-macos-intel: PHASHER_OUTPUT := -o dist/phasher-macos-intel
|
|
|
|
build-cc-macos-intel: flags-release
|
|
|
|
# can't use static build for macOS
|
|
|
|
build-cc-macos-intel: flags-pie
|
|
|
|
build-cc-macos-intel: build
|
|
|
|
|
|
|
|
.PHONY: build-cc-macos-arm
|
|
|
|
build-cc-macos-arm: export GOOS := darwin
|
|
|
|
build-cc-macos-arm: export GOARCH := arm64
|
|
|
|
build-cc-macos-arm: export CC := oa64e-clang
|
|
|
|
build-cc-macos-arm: STASH_OUTPUT := -o dist/stash-macos-arm
|
|
|
|
build-cc-macos-arm: PHASHER_OUTPUT := -o dist/phasher-macos-arm
|
|
|
|
build-cc-macos-arm: flags-release
|
|
|
|
# can't use static build for macOS
|
|
|
|
build-cc-macos-arm: flags-pie
|
|
|
|
build-cc-macos-arm: build
|
|
|
|
|
|
|
|
.PHONY: build-cc-macos
|
|
|
|
build-cc-macos:
|
|
|
|
make build-cc-macos-arm
|
|
|
|
make build-cc-macos-intel
|
|
|
|
|
|
|
|
# Combine into universal binaries
|
|
|
|
lipo -create -output dist/stash-macos dist/stash-macos-intel dist/stash-macos-arm
|
|
|
|
rm dist/stash-macos-intel dist/stash-macos-arm
|
|
|
|
lipo -create -output dist/phasher-macos dist/phasher-macos-intel dist/phasher-macos-arm
|
|
|
|
rm dist/phasher-macos-intel dist/phasher-macos-arm
|
|
|
|
|
2022-02-03 00:20:34 +00:00
|
|
|
# Place into bundle and zip up
|
2023-11-18 23:36:13 +00:00
|
|
|
rm -rf dist/Stash.app
|
2022-02-03 00:20:34 +00:00
|
|
|
cp -R scripts/macos-bundle dist/Stash.app
|
|
|
|
mkdir dist/Stash.app/Contents/MacOS
|
2023-11-18 23:36:13 +00:00
|
|
|
cp dist/stash-macos dist/Stash.app/Contents/MacOS/stash
|
|
|
|
cd dist && rm -f Stash.app.zip && zip -r Stash.app.zip Stash.app
|
2022-02-03 00:20:34 +00:00
|
|
|
rm -rf dist/Stash.app
|
2021-05-16 09:19:56 +00:00
|
|
|
|
2023-11-18 23:36:13 +00:00
|
|
|
.PHONY: build-cc-freebsd
|
|
|
|
build-cc-freebsd: export GOOS := freebsd
|
|
|
|
build-cc-freebsd: export GOARCH := amd64
|
2023-11-20 00:26:57 +00:00
|
|
|
build-cc-freebsd: export CC := clang -target x86_64-unknown-freebsd12.0 --sysroot=/opt/cross-freebsd
|
2023-11-18 23:36:13 +00:00
|
|
|
build-cc-freebsd: STASH_OUTPUT := -o dist/stash-freebsd
|
|
|
|
build-cc-freebsd: PHASHER_OUTPUT := -o dist/phasher-freebsd
|
|
|
|
build-cc-freebsd: flags-release
|
|
|
|
build-cc-freebsd: flags-static-pie
|
|
|
|
build-cc-freebsd: build
|
|
|
|
|
|
|
|
.PHONY: build-cc-linux
|
|
|
|
build-cc-linux: export GOOS := linux
|
|
|
|
build-cc-linux: export GOARCH := amd64
|
|
|
|
build-cc-linux: STASH_OUTPUT := -o dist/stash-linux
|
|
|
|
build-cc-linux: PHASHER_OUTPUT := -o dist/phasher-linux
|
|
|
|
build-cc-linux: flags-release
|
|
|
|
build-cc-linux: flags-static-pie
|
|
|
|
build-cc-linux: build
|
|
|
|
|
|
|
|
.PHONY: build-cc-linux-arm64v8
|
|
|
|
build-cc-linux-arm64v8: export GOOS := linux
|
|
|
|
build-cc-linux-arm64v8: export GOARCH := arm64
|
|
|
|
build-cc-linux-arm64v8: export CC := aarch64-linux-gnu-gcc
|
|
|
|
build-cc-linux-arm64v8: STASH_OUTPUT := -o dist/stash-linux-arm64v8
|
|
|
|
build-cc-linux-arm64v8: PHASHER_OUTPUT := -o dist/phasher-linux-arm64v8
|
|
|
|
build-cc-linux-arm64v8: flags-release
|
|
|
|
build-cc-linux-arm64v8: flags-static-pie
|
|
|
|
build-cc-linux-arm64v8: build
|
|
|
|
|
|
|
|
.PHONY: build-cc-linux-arm32v7
|
|
|
|
build-cc-linux-arm32v7: export GOOS := linux
|
|
|
|
build-cc-linux-arm32v7: export GOARCH := arm
|
|
|
|
build-cc-linux-arm32v7: export GOARM := 7
|
|
|
|
build-cc-linux-arm32v7: export CC := arm-linux-gnueabi-gcc -march=armv7-a
|
|
|
|
build-cc-linux-arm32v7: STASH_OUTPUT := -o dist/stash-linux-arm32v7
|
|
|
|
build-cc-linux-arm32v7: PHASHER_OUTPUT := -o dist/phasher-linux-arm32v7
|
|
|
|
build-cc-linux-arm32v7: flags-release
|
|
|
|
build-cc-linux-arm32v7: flags-static
|
|
|
|
build-cc-linux-arm32v7: build
|
|
|
|
|
|
|
|
.PHONY: build-cc-linux-arm32v6
|
|
|
|
build-cc-linux-arm32v6: export GOOS := linux
|
|
|
|
build-cc-linux-arm32v6: export GOARCH := arm
|
|
|
|
build-cc-linux-arm32v6: export GOARM := 6
|
|
|
|
build-cc-linux-arm32v6: export CC := arm-linux-gnueabi-gcc
|
|
|
|
build-cc-linux-arm32v6: STASH_OUTPUT := -o dist/stash-linux-arm32v6
|
|
|
|
build-cc-linux-arm32v6: PHASHER_OUTPUT := -o dist/phasher-linux-arm32v6
|
|
|
|
build-cc-linux-arm32v6: flags-release
|
|
|
|
build-cc-linux-arm32v6: flags-static
|
|
|
|
build-cc-linux-arm32v6: build
|
|
|
|
|
|
|
|
.PHONY: build-cc-all
|
|
|
|
build-cc-all:
|
|
|
|
make build-cc-windows
|
|
|
|
make build-cc-macos
|
|
|
|
make build-cc-linux
|
|
|
|
make build-cc-linux-arm64v8
|
|
|
|
make build-cc-linux-arm32v7
|
|
|
|
make build-cc-linux-arm32v6
|
2023-11-20 00:26:57 +00:00
|
|
|
make build-cc-freebsd
|
2021-05-16 09:19:56 +00:00
|
|
|
|
2022-03-20 23:31:32 +00:00
|
|
|
.PHONY: touch-ui
|
2022-03-17 00:33:59 +00:00
|
|
|
touch-ui:
|
2023-04-19 01:59:56 +00:00
|
|
|
ifdef IS_WIN_SHELL
|
2022-03-20 23:31:32 +00:00
|
|
|
@if not exist "ui\\v2.5\\build" mkdir ui\\v2.5\\build
|
|
|
|
@type nul >> ui/v2.5/build/index.html
|
2023-04-19 01:59:56 +00:00
|
|
|
else
|
|
|
|
@mkdir -p ui/v2.5/build
|
|
|
|
@touch ui/v2.5/build/index.html
|
2022-03-20 23:31:32 +00:00
|
|
|
endif
|
2022-03-17 00:33:59 +00:00
|
|
|
|
2019-02-14 20:06:37 +00:00
|
|
|
# Regenerates GraphQL files
|
2023-04-19 01:59:56 +00:00
|
|
|
.PHONY: generate
|
2023-07-12 00:05:35 +00:00
|
|
|
generate: generate-backend generate-ui
|
2021-09-08 05:30:15 +00:00
|
|
|
|
2023-07-12 00:05:35 +00:00
|
|
|
.PHONY: generate-ui
|
|
|
|
generate-ui:
|
2020-04-02 21:46:23 +00:00
|
|
|
cd ui/v2.5 && yarn run gqlgen
|
2019-02-14 20:06:37 +00:00
|
|
|
|
2021-09-08 05:30:15 +00:00
|
|
|
.PHONY: generate-backend
|
2023-03-01 04:09:28 +00:00
|
|
|
generate-backend: touch-ui
|
2023-07-11 01:36:57 +00:00
|
|
|
go generate ./cmd/stash
|
2021-09-08 05:30:15 +00:00
|
|
|
|
2022-08-12 02:21:46 +00:00
|
|
|
.PHONY: generate-dataloaders
|
|
|
|
generate-dataloaders:
|
2023-07-11 01:36:57 +00:00
|
|
|
go generate ./internal/api/loaders
|
2022-08-12 02:21:46 +00:00
|
|
|
|
2020-09-17 09:57:18 +00:00
|
|
|
# Regenerates stash-box client files
|
|
|
|
.PHONY: generate-stash-box-client
|
|
|
|
generate-stash-box-client:
|
2023-07-11 01:36:57 +00:00
|
|
|
go run github.com/Yamashou/gqlgenc
|
2020-09-17 09:57:18 +00:00
|
|
|
|
2019-02-14 20:06:37 +00:00
|
|
|
# Runs gofmt -w on the project's source code, modifying any files that do not match its style.
|
|
|
|
.PHONY: fmt
|
|
|
|
fmt:
|
2019-07-28 03:54:27 +00:00
|
|
|
go fmt ./...
|
2019-02-14 20:06:37 +00:00
|
|
|
|
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
Add golangci-lint workflow (#1759)
* Add golangci-lint workflow
* Add a bit more lenient linter timeout
1 Minute isn't always enough, so bump to 3.
* Document golangci, add make target
Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.
* Introduce .golangci.yml
This is the default golangci-lint configuration file location. Use it.
Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.
* Add gofmt and revive to golangci-lint
Read the golangci-lint source code to figure out the configuration format.
Copy the configuration from `revive.toml` into the linter configuration.
* Do not set simplify on gofmt
The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.
* Add new-from-rev
Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.
Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.
* Move to golangci-lint
Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.
Use the frontend build steps in build.yml
Update README to reflect the new world order.
* Remove check-gofmt.sh
The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.
* Remove targets for golangci-lint
Fold these targets into the `lint` target. While here, update README.
2021-09-27 00:41:59 +00:00
|
|
|
golangci-lint run
|
2019-07-28 03:19:54 +00:00
|
|
|
|
2019-11-25 02:10:16 +00:00
|
|
|
# runs unit tests - excluding integration tests
|
|
|
|
.PHONY: test
|
Add golangci-lint workflow (#1759)
* Add golangci-lint workflow
* Add a bit more lenient linter timeout
1 Minute isn't always enough, so bump to 3.
* Document golangci, add make target
Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.
* Introduce .golangci.yml
This is the default golangci-lint configuration file location. Use it.
Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.
* Add gofmt and revive to golangci-lint
Read the golangci-lint source code to figure out the configuration format.
Copy the configuration from `revive.toml` into the linter configuration.
* Do not set simplify on gofmt
The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.
* Add new-from-rev
Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.
Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.
* Move to golangci-lint
Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.
Use the frontend build steps in build.yml
Update README to reflect the new world order.
* Remove check-gofmt.sh
The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.
* Remove targets for golangci-lint
Fold these targets into the `lint` target. While here, update README.
2021-09-27 00:41:59 +00:00
|
|
|
test:
|
2023-07-11 01:36:57 +00:00
|
|
|
go test ./...
|
2019-11-25 02:10:16 +00:00
|
|
|
|
|
|
|
# runs all tests - including integration tests
|
|
|
|
.PHONY: it
|
|
|
|
it:
|
2023-07-11 01:36:57 +00:00
|
|
|
go test -tags=integration ./...
|
2019-11-25 02:10:16 +00:00
|
|
|
|
2020-09-15 07:28:53 +00:00
|
|
|
# generates test mocks
|
|
|
|
.PHONY: generate-test-mocks
|
|
|
|
generate-test-mocks:
|
2023-09-01 00:39:29 +00:00
|
|
|
go run github.com/vektra/mockery/v2
|
2020-09-15 07:28:53 +00:00
|
|
|
|
2023-03-01 04:09:28 +00:00
|
|
|
# runs server
|
|
|
|
# sets the config file to use the local dev config
|
|
|
|
.PHONY: server-start
|
2023-04-19 01:59:56 +00:00
|
|
|
server-start: export STASH_CONFIG_FILE := config.yml
|
|
|
|
server-start: build-flags
|
|
|
|
ifdef IS_WIN_SHELL
|
2023-03-01 04:09:28 +00:00
|
|
|
@if not exist ".local" mkdir .local
|
2023-04-19 01:59:56 +00:00
|
|
|
else
|
|
|
|
@mkdir -p .local
|
2023-03-01 04:09:28 +00:00
|
|
|
endif
|
2023-04-19 01:59:56 +00:00
|
|
|
cd .local && go run $(BUILD_FLAGS) ../cmd/stash
|
2023-03-01 04:09:28 +00:00
|
|
|
|
|
|
|
# removes local dev config files
|
|
|
|
.PHONY: server-clean
|
|
|
|
server-clean:
|
|
|
|
$(RMDIR) .local
|
|
|
|
|
Add golangci-lint workflow (#1759)
* Add golangci-lint workflow
* Add a bit more lenient linter timeout
1 Minute isn't always enough, so bump to 3.
* Document golangci, add make target
Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.
* Introduce .golangci.yml
This is the default golangci-lint configuration file location. Use it.
Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.
* Add gofmt and revive to golangci-lint
Read the golangci-lint source code to figure out the configuration format.
Copy the configuration from `revive.toml` into the linter configuration.
* Do not set simplify on gofmt
The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.
* Add new-from-rev
Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.
Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.
* Move to golangci-lint
Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.
Use the frontend build steps in build.yml
Update README to reflect the new world order.
* Remove check-gofmt.sh
The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.
* Remove targets for golangci-lint
Fold these targets into the `lint` target. While here, update README.
2021-09-27 00:41:59 +00:00
|
|
|
# installs UI dependencies. Run when first cloning repository, or if UI
|
2020-04-29 02:13:08 +00:00
|
|
|
# dependencies have changed
|
|
|
|
.PHONY: pre-ui
|
|
|
|
pre-ui:
|
|
|
|
cd ui/v2.5 && yarn install --frozen-lockfile
|
|
|
|
|
2023-04-19 01:59:56 +00:00
|
|
|
.PHONY: ui-env
|
2023-07-12 00:05:35 +00:00
|
|
|
ui-env: build-info
|
2023-04-19 01:59:56 +00:00
|
|
|
$(eval export VITE_APP_DATE := $(BUILD_DATE))
|
|
|
|
$(eval export VITE_APP_GITHASH := $(GITHASH))
|
|
|
|
$(eval export VITE_APP_STASH_VERSION := $(STASH_VERSION))
|
|
|
|
ifdef STASH_NOLEGACY
|
|
|
|
$(eval export VITE_APP_NOLEGACY := true)
|
|
|
|
endif
|
|
|
|
ifdef STASH_SOURCEMAPS
|
|
|
|
$(eval export VITE_APP_SOURCEMAPS := true)
|
|
|
|
endif
|
|
|
|
|
2021-09-22 03:08:34 +00:00
|
|
|
.PHONY: ui
|
2023-04-19 01:59:56 +00:00
|
|
|
ui: ui-env
|
2020-04-02 21:46:23 +00:00
|
|
|
cd ui/v2.5 && yarn build
|
2020-06-24 05:46:37 +00:00
|
|
|
|
|
|
|
.PHONY: ui-start
|
2023-04-19 01:59:56 +00:00
|
|
|
ui-start: ui-env
|
2021-11-22 01:44:24 +00:00
|
|
|
cd ui/v2.5 && yarn start --host
|
2020-06-22 23:51:57 +00:00
|
|
|
|
2020-06-24 05:46:37 +00:00
|
|
|
.PHONY: fmt-ui
|
2020-04-29 02:13:08 +00:00
|
|
|
fmt-ui:
|
|
|
|
cd ui/v2.5 && yarn format
|
|
|
|
|
Add golangci-lint workflow (#1759)
* Add golangci-lint workflow
* Add a bit more lenient linter timeout
1 Minute isn't always enough, so bump to 3.
* Document golangci, add make target
Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.
* Introduce .golangci.yml
This is the default golangci-lint configuration file location. Use it.
Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.
* Add gofmt and revive to golangci-lint
Read the golangci-lint source code to figure out the configuration format.
Copy the configuration from `revive.toml` into the linter configuration.
* Do not set simplify on gofmt
The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.
* Add new-from-rev
Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.
Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.
* Move to golangci-lint
Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.
Use the frontend build steps in build.yml
Update README to reflect the new world order.
* Remove check-gofmt.sh
The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.
* Remove targets for golangci-lint
Fold these targets into the `lint` target. While here, update README.
2021-09-27 00:41:59 +00:00
|
|
|
# runs all of the frontend PR-acceptance steps
|
2023-07-12 00:05:35 +00:00
|
|
|
.PHONY: validate-ui
|
|
|
|
validate-ui:
|
|
|
|
cd ui/v2.5 && yarn run validate
|
Add golangci-lint workflow (#1759)
* Add golangci-lint workflow
* Add a bit more lenient linter timeout
1 Minute isn't always enough, so bump to 3.
* Document golangci, add make target
Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.
* Introduce .golangci.yml
This is the default golangci-lint configuration file location. Use it.
Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.
* Add gofmt and revive to golangci-lint
Read the golangci-lint source code to figure out the configuration format.
Copy the configuration from `revive.toml` into the linter configuration.
* Do not set simplify on gofmt
The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.
* Add new-from-rev
Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.
Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.
* Move to golangci-lint
Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.
Use the frontend build steps in build.yml
Update README to reflect the new world order.
* Remove check-gofmt.sh
The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.
* Remove targets for golangci-lint
Fold these targets into the `lint` target. While here, update README.
2021-09-27 00:41:59 +00:00
|
|
|
|
|
|
|
# runs all of the backend PR-acceptance steps
|
|
|
|
.PHONY: validate-backend
|
|
|
|
validate-backend: lint it
|
2021-09-08 05:30:15 +00:00
|
|
|
|
2023-07-12 00:05:35 +00:00
|
|
|
# runs all of the tests and checks required for a PR to be accepted
|
|
|
|
.PHONY: validate
|
|
|
|
validate: validate-ui validate-backend
|
|
|
|
|
2021-09-08 05:30:15 +00:00
|
|
|
# locally builds and tags a 'stash/build' docker image
|
|
|
|
.PHONY: docker-build
|
2023-07-12 00:05:35 +00:00
|
|
|
docker-build: build-info
|
2021-10-22 02:14:08 +00:00
|
|
|
docker build --build-arg GITHASH=$(GITHASH) --build-arg STASH_VERSION=$(STASH_VERSION) -t stash/build -f docker/build/x86_64/Dockerfile .
|
2023-03-10 00:25:55 +00:00
|
|
|
|
|
|
|
# locally builds and tags a 'stash/cuda-build' docker image
|
|
|
|
.PHONY: docker-cuda-build
|
2023-07-12 00:05:35 +00:00
|
|
|
docker-cuda-build: build-info
|
2023-03-10 00:25:55 +00:00
|
|
|
docker build --build-arg GITHASH=$(GITHASH) --build-arg STASH_VERSION=$(STASH_VERSION) -t stash/cuda-build -f docker/build/x86_64/Dockerfile-CUDA .
|
2024-02-16 01:39:45 +00:00
|
|
|
|
|
|
|
# start the build container - for cross compilation
|
|
|
|
# this is adapted from the github actions build.yml file
|
|
|
|
.PHONY: start-compiler-container
|
|
|
|
start-compiler-container:
|
|
|
|
docker run -d --name build --mount type=bind,source="$(PWD)",target=/stash,consistency=delegated $(EXTRA_CONTAINER_ARGS) -w /stash $(COMPILER_IMAGE) tail -f /dev/null
|
|
|
|
|
|
|
|
# run the cross-compilation using
|
|
|
|
# docker exec -t build /bin/bash -c "make build-cc-<platform>"
|
|
|
|
|
|
|
|
.PHONY: remove-compiler-container
|
|
|
|
remove-compiler-container:
|
|
|
|
docker rm -f -v build
|