Merge branch 'ci/multi_os' (Resolve #18)

This commit is contained in:
Yuta Hayashibe 2022-10-10 00:48:18 +09:00
commit b282f88cfb
4 changed files with 28 additions and 8 deletions

View file

@ -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
@ -44,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)

View file

@ -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:
@ -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

13
scripts/check_null.py Normal file
View file

@ -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()

View file

@ -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,9 +47,13 @@ def main() -> None:
if opts.tags:
tags = []
with opts.tags.open() as f:
for line in f:
if opts.tags == "-":
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")