From 39ace87958d5a74deb60d1acea52664f4044696b Mon Sep 17 00:00:00 2001 From: Yuta Hayashibe Date: Mon, 10 Oct 2022 00:06:37 +0900 Subject: [PATCH 1/5] Add Windows and Mac to CI --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33c4327..2fa718e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,10 @@ on: # yamllint disable-line rule:truthy jobs: ci: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v3 - name: Get tags From 0cd6425a4f9cbbef6dcecefab33b2940a727aacb Mon Sep 17 00:00:00 2001 From: Yuta Hayashibe Date: Mon, 10 Oct 2022 00:06:59 +0900 Subject: [PATCH 2/5] Use node16 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fa718e..1c24639 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '16' cache: npm - run: npm install - run: poetry run make -j $(nproc) From 9e4b88fb6a5d0af77beca9e60d927b14850eb8e6 Mon Sep 17 00:00:00 2001 From: Yuta Hayashibe Date: Mon, 10 Oct 2022 00:27:31 +0900 Subject: [PATCH 3/5] Fix operation of /dev/stdin for Windows --- scripts/check_version.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/check_version.py b/scripts/check_version.py index c494b42..04c7b03 100644 --- a/scripts/check_version.py +++ b/scripts/check_version.py @@ -47,9 +47,13 @@ def main() -> None: if opts.tags: tags = [] - with opts.tags.open() as f: - for line in f: + if str(opts.tags) == "/dev/stdin": + for line in sys.stdin: tags.append(line[:-1]) + else: + with opts.tags.open() as f: + for line in f: + tags.append(line[:-1]) if stable_version not in tags: sys.stderr.write(f"Tag {stable_version} not in git tags: {tags}\n") From 84f8d0dfe7014ef6ce4c006d8ae002cd87e7713a Mon Sep 17 00:00:00 2001 From: Yuta Hayashibe Date: Mon, 10 Oct 2022 00:36:51 +0900 Subject: [PATCH 4/5] Fix operation of /dev/null for Windows --- Makefile | 4 ++-- scripts/check_null.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 scripts/check_null.py diff --git a/Makefile b/Makefile index 2ba06cf..f2ff064 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,9 @@ TARGET_DIRS:=./whispering flake8: find $(TARGET_DIRS) | grep '\.py$$' | xargs flake8 black: - find $(TARGET_DIRS) | grep '\.py$$' | xargs black --diff | diff /dev/null - + find $(TARGET_DIRS) | grep '\.py$$' | xargs black --diff | python ./scripts/check_null.py isort: - find $(TARGET_DIRS) | grep '\.py$$' | xargs isort --diff | diff /dev/null - + find $(TARGET_DIRS) | grep '\.py$$' | xargs isort --diff | python ./scripts/check_null.py pydocstyle: find $(TARGET_DIRS) | grep -v tests | xargs pydocstyle --ignore=D100,D101,D102,D103,D104,D105,D107,D203,D212 pytest: diff --git a/scripts/check_null.py b/scripts/check_null.py new file mode 100644 index 0000000..b797863 --- /dev/null +++ b/scripts/check_null.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + + +def main() -> None: + data = sys.stdin.read() + if len(data) != 0: + sys.exit(1) + + +if __name__ == "__main__": + main() From 177fc3d3537abe0490ed44a6be58f41ac9c8fc39 Mon Sep 17 00:00:00 2001 From: Yuta Hayashibe Date: Mon, 10 Oct 2022 00:42:06 +0900 Subject: [PATCH 5/5] Fix for Windows --- Makefile | 2 +- scripts/check_version.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f2ff064..1876363 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ yamllint: | xargs yamllint --no-warnings version_check: - git tag | python ./scripts/check_version.py --toml pyproject.toml -i README.md --tags /dev/stdin + git tag | python ./scripts/check_version.py --toml pyproject.toml -i README.md --tags - lint_python: flake8 black isort pydocstyle version_check pytest diff --git a/scripts/check_version.py b/scripts/check_version.py index 04c7b03..5ffc97b 100644 --- a/scripts/check_version.py +++ b/scripts/check_version.py @@ -33,7 +33,7 @@ def get_opts() -> argparse.Namespace: oparser = argparse.ArgumentParser() oparser.add_argument("--input", "-i", type=Path) oparser.add_argument("--toml", "-t", type=Path, required=True) - oparser.add_argument("--tags", type=Path) + oparser.add_argument("--tags") return oparser.parse_args() @@ -47,7 +47,7 @@ def main() -> None: if opts.tags: tags = [] - if str(opts.tags) == "/dev/stdin": + if opts.tags == "-": for line in sys.stdin: tags.append(line[:-1]) else: