generated from deepgram/oss-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Makefile
92 lines (69 loc) · 2.8 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright 2024 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT
# detect the build OS
ifeq ($(OS),Windows_NT)
build_OS := Windows
NUL = NUL
else
build_OS := $(shell uname -s 2>/dev/null || echo Unknown)
NUL = /dev/null
endif
.DEFAULT_GOAL:=help
##### GLOBAL
ROOT_DIR := $(shell git rev-parse --show-toplevel)
# Add tooling binaries here and in hack/tools/Makefile
TOOLS_BIN_DIR := $(shell mktemp -d)
help: #### Display help
@echo ''
@echo 'Syntax: make <target>'
@awk 'BEGIN {FS = ":.*## "; printf "\nTargets:\n"} /^[a-zA-Z_-]+:.*?#### / { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@echo ''
##### GLOBAL
##### LINTING TARGETS
.PHONY: version
version: #### display version of components
@echo 'ROOT_DIR: $(ROOT_DIR)'
@echo 'GOOS: $(GOOS)'
@echo 'GOARCH: $(GOARCH)'
@echo 'go version: $(shell go version)'
.PHONY: check lint pylint format black blackformat lint-files lint-diff static mypy mdlint shellcheck actionlint yamllint ### Performs all of the checks, lint'ing, etc available
check: lint static mdlint shellcheck actionlint yamllint
.PHONY: ensure-deps
ensure-deps: #### Ensure that all required dependency utilities are downloaded or installed
hack/ensure-deps/ensure-dependencies.sh
GO_MODULES=$(shell find . -path "*/go.mod" | xargs -I _ dirname _)
PYTHON_FILES=.
lint-files: PYTHON_FILES=deepgram/ examples/
lint-diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$')
lint-files lint-diff: #### Performs Python formatting
black --target-version py310 $(PYTHON_FILES)
black blackformat format: lint-files
pylint: lint-files #### Performs Python linting
pylint --disable=W0622 --disable=W0404 --disable=W0611 --rcfile .pylintrc deepgram
lint: pylint #### Performs Golang programming lint
static mypy: #### Performs static analysis
mypy --config-file mypy.ini --python-version 3.10 --exclude tests --exclude examples $(PYTHON_FILES)
mdlint: #### Performs Markdown lint
# mdlint rules with common errors and possible fixes can be found here:
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
hack/check/check-mdlint.sh
shellcheck: #### Performs bash/shell lint
hack/check/check-shell.sh
yamllint: #### Performs yaml lint
hack/check/check-yaml.sh
actionlint: #### Performs GitHub Actions lint
actionlint
##### LINTING TARGETS
##### TESTING TARGETS
.PHONY: test daily-test unit-test
test: #### Run ALL tests
@echo "Running ALL tests"
python -m pytest
daily-test: #### Run daily tests
@echo "Running daily tests"
python -m pytest -k daily_test
unit-test: #### Run unit tests
@echo "Running unit tests"
python -m pytest -k unit_test
##### TESTING TARGETS