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: jobs:
ci: ci:
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Get tags - name: Get tags
@ -44,7 +47,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: '16'
cache: npm cache: npm
- run: npm install - run: npm install
- run: poetry run make -j $(nproc) - run: poetry run make -j $(nproc)

View file

@ -8,9 +8,9 @@ TARGET_DIRS:=./whispering
flake8: flake8:
find $(TARGET_DIRS) | grep '\.py$$' | xargs flake8 find $(TARGET_DIRS) | grep '\.py$$' | xargs flake8
black: 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: 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: pydocstyle:
find $(TARGET_DIRS) | grep -v tests | xargs pydocstyle --ignore=D100,D101,D102,D103,D104,D105,D107,D203,D212 find $(TARGET_DIRS) | grep -v tests | xargs pydocstyle --ignore=D100,D101,D102,D103,D104,D105,D107,D203,D212
pytest: pytest:
@ -21,7 +21,7 @@ yamllint:
| xargs yamllint --no-warnings | xargs yamllint --no-warnings
version_check: 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 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 = argparse.ArgumentParser()
oparser.add_argument("--input", "-i", type=Path) oparser.add_argument("--input", "-i", type=Path)
oparser.add_argument("--toml", "-t", type=Path, required=True) oparser.add_argument("--toml", "-t", type=Path, required=True)
oparser.add_argument("--tags", type=Path) oparser.add_argument("--tags")
return oparser.parse_args() return oparser.parse_args()
@ -47,6 +47,10 @@ def main() -> None:
if opts.tags: if opts.tags:
tags = [] tags = []
if opts.tags == "-":
for line in sys.stdin:
tags.append(line[:-1])
else:
with opts.tags.open() as f: with opts.tags.open() as f:
for line in f: for line in f:
tags.append(line[:-1]) tags.append(line[:-1])