-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #734 from linshokaku/makefile-utils
Make Command Calls in GitHub Workflows
- Loading branch information
Showing
8 changed files
with
70 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
SHELL := bash | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
MAKEFLAGS += --warn-undefined-variables | ||
.DEFAULT_GOAL := help | ||
|
||
PWD := $(realpath $(dir $(abspath $(firstword $(MAKEFILE_LIST))))) | ||
|
||
PY := python | ||
PIP := $(PY) -m pip | ||
|
||
.PHONY: format | ||
format: ## Format the Python code. | ||
cp "$$($(PIP) show torch | awk '/^Location:/ { print $$2 }')/torch/__init__.py" stubs/torch/__init__.py | ||
trap "rm -f stubs/torch/__init__.py" EXIT; MYPYPATH="$(PWD)/stubs" $(PY) -m pysen run format lint | ||
|
||
.PHONY: lint | ||
lint: ## Lint the Python code. | ||
cp "$$($(PIP) show torch | awk '/^Location:/ { print $$2 }')/torch/__init__.py" stubs/torch/__init__.py | ||
trap "rm -f stubs/torch/__init__.py" EXIT; MYPYPATH="$(PWD)/stubs" $(PY) -m pysen run lint | ||
|
||
.PHONY: test | ||
test: ## Run all tests. | ||
$(PY) -m pytest tests | ||
|
||
.PHONY: cputest | ||
cputest: ## Run all tests except for ones requiring GPU. | ||
$(PY) -m pytest -m "not gpu" tests | ||
|
||
.PHONY: example_lint | ||
example_lint: ## Format the Python code. | ||
$(PY) -m pysen --config ./example/pysen.toml run lint | ||
|
||
.PHONY: help | ||
help: ## Display this help message. | ||
@grep -E '^[%%a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ | ||
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters