mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-11-16 07:08:03 +00:00
Move away from dbmate, use PolySchema
This commit is contained in:
1 parent
52399c42f1
commit
2a14f3f84c
99 files changed
+1583
-1691
No files matched your search
+24
-14
@@ -1,22 +1,32 @@
|
||||
#!/bin/bash
|
||||
set -eufo pipefail
|
||||
|
||||
BLUE='\E[1;34m'
|
||||
YELLOW='\E[1;33m'
|
||||
RESET='\E[0m'
|
||||
RESULT=0
|
||||
export RED='\E[1;31m'
|
||||
export YELLOW='\E[1;33m'
|
||||
export RESET='\033[0m'
|
||||
|
||||
# go files: incomplete comment check
|
||||
INCOMPLETE_COMMENTS=$(find . -iname "*.go*" | grep -v " " | xargs grep --colour -H -n -E "^\s*\/\/\s*[A-Z]\w+ \.{3}" 2>/dev/null)
|
||||
if [[ -n "$INCOMPLETE_COMMENTS" ]]; then
|
||||
echo -e "${BLUE}❯ ${YELLOW}WARN: Please fix incomplete exported comments:${RESET}"
|
||||
echo -e "${RED}${INCOMPLETE_COMMENTS}${RESET}"
|
||||
echo
|
||||
# RESULT=1
|
||||
PROJECT_DIR="$(cd -- "$(dirname -- "$0")/.." && pwd)"
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
trap cleanup EXIT
|
||||
cleanup() {
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "${RED}LINTING FAILED${RESET}"
|
||||
fi
|
||||
}
|
||||
|
||||
if ! command -v golangci-lint &>/dev/null; then
|
||||
echo -e "${YELLOW}Installing golangci-lint ...${RESET}"
|
||||
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}golangci-lint ...${RESET}"
|
||||
if ! golangci-lint run -E goimports ./...; then
|
||||
exit 1
|
||||
golangci-lint --max-same-issues=0 --max-issues-per-linter=0 run ./...
|
||||
|
||||
if ! command -v modernize &>/dev/null; then
|
||||
echo -e "${YELLOW}Installing modernize ...${RESET}"
|
||||
go install golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest
|
||||
fi
|
||||
|
||||
exit "$RESULT"
|
||||
echo -e "${YELLOW}modernize ...${RESET}"
|
||||
modernize -test "$@" ./...
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
if ! command -v go-test-coverage &>/dev/null; then
|
||||
go install github.com/vladopajic/go-test-coverage/v2@latest
|
||||
fi
|
||||
if ! command -v tparse &>/dev/null; then
|
||||
go install github.com/mfridman/tparse@latest
|
||||
fi
|
||||
|
||||
rm -f "$DIR/coverage.html"
|
||||
|
||||
trap cleanup EXIT
|
||||
cleanup() {
|
||||
rm -f "$DIR/coverage.out"
|
||||
}
|
||||
|
||||
echo "Running go test suite ..."
|
||||
go test -json -cover ./... -coverprofile="$DIR/coverage.out" | tparse
|
||||
go tool cover -html="$DIR/coverage.out" -o "$DIR/coverage.html"
|
||||
go-test-coverage -c "$DIR/.testcoverage.yml"
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
export RED='\E[1;31m'
|
||||
export YELLOW='\E[1;33m'
|
||||
export RESET='\033[0m'
|
||||
|
||||
cd -- "$(dirname -- "$0")/.." || exit 1
|
||||
|
||||
if ! command -v go-test-coverage &>/dev/null; then
|
||||
echo -e "${YELLOW}Installing go-test-coverage ...${RESET}"
|
||||
go install github.com/vladopajic/go-test-coverage/v2@latest
|
||||
fi
|
||||
|
||||
if ! command -v tparse &>/dev/null; then
|
||||
echo -e "${YELLOW}Installing tparse ...${RESET}"
|
||||
go install github.com/mfridman/tparse@latest
|
||||
fi
|
||||
|
||||
if ! command -v go-junit-report &>/dev/null; then
|
||||
echo -e "${YELLOW}Installing go-junit-report ...${RESET}"
|
||||
go install github.com/jstemmer/go-junit-report/v2@latest
|
||||
fi
|
||||
|
||||
trap cleanup EXIT
|
||||
cleanup() {
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -e "${RED}UNIT TESTING FAILED - check output and consider minimum coverage requirements${RESET}"
|
||||
fi
|
||||
rm -f coverage.out
|
||||
}
|
||||
|
||||
mkdir -p ../test/results/html-reports ../test/results/junit
|
||||
go test -json -cover -coverprofile="./coverage.out" ./... | tparse || true
|
||||
go tool cover -html="./coverage.out" -o "../test/results/html-reports/backend-coverage.html"
|
||||
go test -v -covermode=atomic ./... 2>&1 | go-junit-report >../test/results/junit/backend.xml
|
||||
|
||||
# this enforces minimum coverage requirements
|
||||
go-test-coverage -c .testcoverage.yml
|
||||
Reference in new issue
Block a user