diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33c4327..1c24639 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 @@ -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) diff --git a/Makefile b/Makefile index 2ba06cf..1876363 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: @@ -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_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() diff --git a/scripts/check_version.py b/scripts/check_version.py index c494b42..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,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")