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
|
2019-07-28 03:19:54 +00:00
|
|
|
SEPARATOR := &&
|
|
|
|
SET := set
|
2023-03-01 04:09:28 +00:00
|
|
|
RM := del /s /q
|
|
|
|
RMDIR := rmdir /s /q
|
|
|
|
PWD := $(shell echo %cd%)
|
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
|
2020-06-22 23:51:57 +00:00
|
|
|
SEPARATOR := ;
|
|
|
|
SET := export
|
2023-03-01 04:09:28 +00:00
|
|
|
RM := rm -f
|
|
|
|
RMDIR := rm -rf
|
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
|
|
|
|
# set OUTPUT to generate a specific binary name
|
|
|
|
|
|
|
|
LDFLAGS := $(LDFLAGS)
|
|
|
|
ifdef OUTPUT
|
|
|
|
OUTPUT := -o $(OUTPUT)
|
|
|
|
endif
|
|
|
|
|
2021-05-16 09:19:56 +00:00
|
|
|
export CGO_ENABLED = 1
|
|
|
|
|
2022-11-22 22:10:39 +00:00
|
|
|
# including netgo causes name resolution to go through the Go resolver
|
|
|
|
# and isn't necessary for static builds on Windows
|
|
|
|
GO_BUILD_TAGS_WINDOWS := sqlite_omit_load_extension sqlite_stat4 osusergo
|
|
|
|
GO_BUILD_TAGS_DEFAULT = $(GO_BUILD_TAGS_WINDOWS) netgo
|
|
|
|
|
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
|
|
|
.PHONY: release pre-build
|
2020-06-29 04:44:21 +00:00
|
|
|
|
2022-10-25 22:18:02 +00:00
|
|
|
release: pre-ui generate ui build-release
|
2019-12-28 17:53:16 +00:00
|
|
|
|
2020-06-22 23:51:57 +00:00
|
|
|
pre-build:
|
2020-06-29 04:44:21 +00:00
|
|
|
ifndef BUILD_DATE
|
|
|
|
$(eval BUILD_DATE := $(shell go run -mod=vendor scripts/getDate.go))
|
|
|
|
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
|
2020-06-22 23:51:57 +00:00
|
|
|
|
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
|
|
|
|
|
2022-11-22 22:10:39 +00:00
|
|
|
ifndef GO_BUILD_TAGS
|
|
|
|
$(eval GO_BUILD_TAGS := $(GO_BUILD_TAGS_DEFAULT))
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# NOTE: the build target still includes netgo because we cannot detect
|
|
|
|
# Windows easily from the Makefile.
|
2022-03-17 00:33:59 +00:00
|
|
|
build: pre-build
|
2022-02-03 00:20:34 +00:00
|
|
|
build:
|
2022-03-17 00:33:59 +00:00
|
|
|
$(eval LDFLAGS := $(LDFLAGS) -X 'github.com/stashapp/stash/internal/api.version=$(STASH_VERSION)' -X 'github.com/stashapp/stash/internal/api.buildstamp=$(BUILD_DATE)' -X 'github.com/stashapp/stash/internal/api.githash=$(GITHASH)')
|
|
|
|
$(eval LDFLAGS := $(LDFLAGS) -X 'github.com/stashapp/stash/internal/manager/config.officialBuild=$(OFFICIAL_BUILD)')
|
2022-11-22 22:10:39 +00:00
|
|
|
go build $(OUTPUT) -mod=vendor -v -tags "$(GO_BUILD_TAGS)" $(GO_BUILD_FLAGS) -ldflags "$(LDFLAGS) $(EXTRA_LDFLAGS) $(PLATFORM_SPECIFIC_LDFLAGS)" ./cmd/stash
|
2020-06-29 04:44:21 +00:00
|
|
|
|
|
|
|
# strips debug symbols from the release build
|
|
|
|
build-release: EXTRA_LDFLAGS := -s -w
|
2021-09-08 05:30:15 +00:00
|
|
|
build-release: GO_BUILD_FLAGS := -trimpath
|
2020-06-29 04:44:21 +00:00
|
|
|
build-release: build
|
2019-02-10 12:16:29 +00:00
|
|
|
|
2020-09-14 01:12:36 +00:00
|
|
|
build-release-static: EXTRA_LDFLAGS := -extldflags=-static -s -w
|
2021-09-08 05:30:15 +00:00
|
|
|
build-release-static: GO_BUILD_FLAGS := -trimpath
|
2020-09-14 01:12:36 +00:00
|
|
|
build-release-static: build
|
|
|
|
|
2021-05-16 09:19:56 +00:00
|
|
|
# cross-compile- targets should be run within the compiler docker container
|
|
|
|
cross-compile-windows: export GOOS := windows
|
|
|
|
cross-compile-windows: export GOARCH := amd64
|
|
|
|
cross-compile-windows: export CC := x86_64-w64-mingw32-gcc
|
|
|
|
cross-compile-windows: export CXX := x86_64-w64-mingw32-g++
|
|
|
|
cross-compile-windows: OUTPUT := -o dist/stash-win.exe
|
2022-11-22 22:10:39 +00:00
|
|
|
cross-compile-windows: GO_BUILD_TAGS := $(GO_BUILD_TAGS_WINDOWS)
|
2021-05-16 09:19:56 +00:00
|
|
|
cross-compile-windows: build-release-static
|
|
|
|
|
2022-02-03 00:20:34 +00:00
|
|
|
cross-compile-macos-intel: export GOOS := darwin
|
|
|
|
cross-compile-macos-intel: export GOARCH := amd64
|
|
|
|
cross-compile-macos-intel: export CC := o64-clang
|
|
|
|
cross-compile-macos-intel: export CXX := o64-clang++
|
|
|
|
cross-compile-macos-intel: OUTPUT := -o dist/stash-macos-intel
|
2022-11-22 22:10:39 +00:00
|
|
|
cross-compile-macos-intel: GO_BUILD_TAGS := $(GO_BUILD_TAGS_DEFAULT)
|
2021-05-16 09:19:56 +00:00
|
|
|
# can't use static build for OSX
|
2022-02-03 00:20:34 +00:00
|
|
|
cross-compile-macos-intel: build-release
|
2021-09-08 05:30:15 +00:00
|
|
|
|
2022-02-03 00:20:34 +00:00
|
|
|
cross-compile-macos-applesilicon: export GOOS := darwin
|
|
|
|
cross-compile-macos-applesilicon: export GOARCH := arm64
|
|
|
|
cross-compile-macos-applesilicon: export CC := oa64e-clang
|
|
|
|
cross-compile-macos-applesilicon: export CXX := oa64e-clang++
|
|
|
|
cross-compile-macos-applesilicon: OUTPUT := -o dist/stash-macos-applesilicon
|
2022-11-22 22:10:39 +00:00
|
|
|
cross-compile-macos-applesilicon: GO_BUILD_TAGS := $(GO_BUILD_TAGS_DEFAULT)
|
2021-09-08 05:30:15 +00:00
|
|
|
# can't use static build for OSX
|
2022-02-03 00:20:34 +00:00
|
|
|
cross-compile-macos-applesilicon: build-release
|
|
|
|
|
2023-03-01 04:09:28 +00:00
|
|
|
cross-compile-macos:
|
2022-02-03 00:20:34 +00:00
|
|
|
rm -rf dist/Stash.app dist/Stash-macos.zip
|
|
|
|
make cross-compile-macos-applesilicon
|
|
|
|
make cross-compile-macos-intel
|
|
|
|
# Combine into one universal binary
|
|
|
|
lipo -create -output dist/stash-macos-universal dist/stash-macos-intel dist/stash-macos-applesilicon
|
|
|
|
rm dist/stash-macos-intel dist/stash-macos-applesilicon
|
|
|
|
# Place into bundle and zip up
|
|
|
|
cp -R scripts/macos-bundle dist/Stash.app
|
|
|
|
mkdir dist/Stash.app/Contents/MacOS
|
|
|
|
mv dist/stash-macos-universal dist/Stash.app/Contents/MacOS/stash
|
|
|
|
cd dist && zip -r Stash-macos.zip Stash.app && cd ..
|
|
|
|
rm -rf dist/Stash.app
|
2021-05-16 09:19:56 +00:00
|
|
|
|
2022-04-06 05:35:32 +00:00
|
|
|
cross-compile-freebsd: export GOOS := freebsd
|
|
|
|
cross-compile-freebsd: export GOARCH := amd64
|
|
|
|
cross-compile-freebsd: OUTPUT := -o dist/stash-freebsd
|
2022-11-22 22:10:39 +00:00
|
|
|
cross-compile-freebsd: GO_BUILD_TAGS += netgo
|
2022-04-06 05:35:32 +00:00
|
|
|
cross-compile-freebsd: build-release-static
|
|
|
|
|
2021-05-16 09:19:56 +00:00
|
|
|
cross-compile-linux: export GOOS := linux
|
|
|
|
cross-compile-linux: export GOARCH := amd64
|
|
|
|
cross-compile-linux: OUTPUT := -o dist/stash-linux
|
2022-11-22 22:10:39 +00:00
|
|
|
cross-compile-linux: GO_BUILD_TAGS := $(GO_BUILD_TAGS_DEFAULT)
|
2021-05-16 09:19:56 +00:00
|
|
|
cross-compile-linux: build-release-static
|
|
|
|
|
|
|
|
cross-compile-linux-arm64v8: export GOOS := linux
|
|
|
|
cross-compile-linux-arm64v8: export GOARCH := arm64
|
|
|
|
cross-compile-linux-arm64v8: export CC := aarch64-linux-gnu-gcc
|
|
|
|
cross-compile-linux-arm64v8: OUTPUT := -o dist/stash-linux-arm64v8
|
2022-11-22 22:10:39 +00:00
|
|
|
cross-compile-linux-arm64v8: GO_BUILD_TAGS := $(GO_BUILD_TAGS_DEFAULT)
|
2021-05-16 09:19:56 +00:00
|
|
|
cross-compile-linux-arm64v8: build-release-static
|
|
|
|
|
|
|
|
cross-compile-linux-arm32v7: export GOOS := linux
|
|
|
|
cross-compile-linux-arm32v7: export GOARCH := arm
|
|
|
|
cross-compile-linux-arm32v7: export GOARM := 7
|
|
|
|
cross-compile-linux-arm32v7: export CC := arm-linux-gnueabihf-gcc
|
|
|
|
cross-compile-linux-arm32v7: OUTPUT := -o dist/stash-linux-arm32v7
|
2022-11-22 22:10:39 +00:00
|
|
|
cross-compile-linux-arm32v7: GO_BUILD_TAGS := $(GO_BUILD_TAGS_DEFAULT)
|
2021-05-16 09:19:56 +00:00
|
|
|
cross-compile-linux-arm32v7: build-release-static
|
|
|
|
|
2022-02-03 00:20:34 +00:00
|
|
|
cross-compile-linux-arm32v6: export GOOS := linux
|
|
|
|
cross-compile-linux-arm32v6: export GOARCH := arm
|
|
|
|
cross-compile-linux-arm32v6: export GOARM := 6
|
|
|
|
cross-compile-linux-arm32v6: export CC := arm-linux-gnueabi-gcc
|
|
|
|
cross-compile-linux-arm32v6: OUTPUT := -o dist/stash-linux-arm32v6
|
2022-11-22 22:10:39 +00:00
|
|
|
cross-compile-linux-arm32v6: GO_BUILD_TAGS := $(GO_BUILD_TAGS_DEFAULT)
|
2022-02-03 00:20:34 +00:00
|
|
|
cross-compile-linux-arm32v6: build-release-static
|
2021-05-16 09:19:56 +00:00
|
|
|
|
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
|
|
|
cross-compile-all:
|
|
|
|
make cross-compile-windows
|
2022-11-09 03:41:23 +00:00
|
|
|
make cross-compile-macos-intel
|
|
|
|
make cross-compile-macos-applesilicon
|
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
|
|
|
make cross-compile-linux
|
|
|
|
make cross-compile-linux-arm64v8
|
|
|
|
make cross-compile-linux-arm32v7
|
2022-02-03 00:20:34 +00:00
|
|
|
make cross-compile-linux-arm32v6
|
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:
|
2022-03-20 23:31:32 +00:00
|
|
|
ifndef IS_WIN_SHELL
|
2022-03-17 00:33:59 +00:00
|
|
|
@mkdir -p ui/v2.5/build
|
|
|
|
@touch ui/v2.5/build/index.html
|
2022-03-20 23:31:32 +00:00
|
|
|
else
|
|
|
|
@if not exist "ui\\v2.5\\build" mkdir ui\\v2.5\\build
|
|
|
|
@type nul >> ui/v2.5/build/index.html
|
|
|
|
endif
|
2022-03-17 00:33:59 +00:00
|
|
|
|
2019-02-14 20:06:37 +00:00
|
|
|
# Regenerates GraphQL files
|
2021-09-08 05:30:15 +00:00
|
|
|
generate: generate-backend generate-frontend
|
|
|
|
|
|
|
|
.PHONY: generate-frontend
|
|
|
|
generate-frontend:
|
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
|
2022-03-17 00:33:59 +00:00
|
|
|
go generate -mod=vendor ./cmd/stash
|
2021-09-08 05:30:15 +00:00
|
|
|
|
2022-08-12 02:21:46 +00:00
|
|
|
.PHONY: generate-dataloaders
|
|
|
|
generate-dataloaders:
|
|
|
|
go generate -mod=vendor ./internal/api/loaders
|
|
|
|
|
2020-09-17 09:57:18 +00:00
|
|
|
# Regenerates stash-box client files
|
|
|
|
.PHONY: generate-stash-box-client
|
|
|
|
generate-stash-box-client:
|
|
|
|
go run -mod=vendor github.com/Yamashou/gqlgenc
|
|
|
|
|
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:
|
2019-11-25 02:10:16 +00:00
|
|
|
go test -mod=vendor ./...
|
|
|
|
|
|
|
|
# runs all tests - including integration tests
|
|
|
|
.PHONY: it
|
|
|
|
it:
|
|
|
|
go test -mod=vendor -tags=integration ./...
|
|
|
|
|
2020-09-15 07:28:53 +00:00
|
|
|
# generates test mocks
|
|
|
|
.PHONY: generate-test-mocks
|
|
|
|
generate-test-mocks:
|
|
|
|
go run -mod=vendor github.com/vektra/mockery/v2 --dir ./pkg/models --name '.*ReaderWriter' --outpkg mocks --output ./pkg/models/mocks
|
|
|
|
|
2023-03-01 04:09:28 +00:00
|
|
|
# runs server
|
|
|
|
# sets the config file to use the local dev config
|
|
|
|
.PHONY: server-start
|
|
|
|
server-start: export STASH_CONFIG_FILE=config.yml
|
|
|
|
server-start:
|
|
|
|
ifndef IS_WIN_SHELL
|
|
|
|
@mkdir -p .local
|
|
|
|
else
|
|
|
|
@if not exist ".local" mkdir .local
|
|
|
|
endif
|
|
|
|
cd .local && go run ../cmd/stash
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2021-09-22 03:08:34 +00:00
|
|
|
.PHONY: ui
|
|
|
|
ui: pre-build
|
2021-11-18 01:32:04 +00:00
|
|
|
$(SET) VITE_APP_DATE="$(BUILD_DATE)" $(SEPARATOR) \
|
|
|
|
$(SET) VITE_APP_GITHASH=$(GITHASH) $(SEPARATOR) \
|
|
|
|
$(SET) VITE_APP_STASH_VERSION=$(STASH_VERSION) $(SEPARATOR) \
|
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
|
2020-06-22 23:51:57 +00:00
|
|
|
ui-start: pre-build
|
2021-11-18 01:32:04 +00:00
|
|
|
$(SET) VITE_APP_DATE="$(BUILD_DATE)" $(SEPARATOR) \
|
|
|
|
$(SET) VITE_APP_GITHASH=$(GITHASH) $(SEPARATOR) \
|
|
|
|
$(SET) VITE_APP_STASH_VERSION=$(STASH_VERSION) $(SEPARATOR) \
|
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
|
|
|
|
|
|
|
|
# runs tests and checks on the UI and builds it
|
|
|
|
.PHONY: ui-validate
|
|
|
|
ui-validate:
|
|
|
|
cd ui/v2.5 && yarn run validate
|
|
|
|
|
|
|
|
# runs all of the tests and checks required for a PR to be accepted
|
|
|
|
.PHONY: 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
|
|
|
validate: validate-frontend validate-backend
|
|
|
|
|
|
|
|
# runs all of the frontend PR-acceptance steps
|
|
|
|
.PHONY: validate-frontend
|
|
|
|
validate-frontend: ui-validate
|
|
|
|
|
|
|
|
# runs all of the backend PR-acceptance steps
|
|
|
|
.PHONY: validate-backend
|
|
|
|
validate-backend: lint it
|
2021-09-08 05:30:15 +00:00
|
|
|
|
|
|
|
# locally builds and tags a 'stash/build' docker image
|
|
|
|
.PHONY: docker-build
|
2021-10-22 02:14:08 +00:00
|
|
|
docker-build: pre-build
|
|
|
|
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
|
|
|
|
docker-cuda-build: pre-build
|
|
|
|
docker build --build-arg GITHASH=$(GITHASH) --build-arg STASH_VERSION=$(STASH_VERSION) -t stash/cuda-build -f docker/build/x86_64/Dockerfile-CUDA .
|