diff --git a/.github/workflows/continuous-integration-static-type-checking.yml b/.github/workflows/continuous-integration-static-type-checking.yml new file mode 100644 index 00000000..aa5c27b4 --- /dev/null +++ b/.github/workflows/continuous-integration-static-type-checking.yml @@ -0,0 +1,35 @@ +name: Continuous Integration - Static Type Checking + +on: [push, pull_request] + +jobs: + continuous-integration-static-type-checking: + name: ${{ matrix.os }} - Python ${{ matrix.python-version }} + strategy: + matrix: + os: [macOS-latest] + python-version: [3.11] + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v1 + - name: Environment Variables + run: | + echo "CI_PACKAGE=opencolorio_config_aces" >> $GITHUB_ENV + shell: bash + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies (macOS) + if: matrix.os == 'macOS-latest' + run: | + brew install graphviz + export GRAPHVIZ_DIR="/usr/local/Cellar/graphviz/" + pip install pygraphviz --global-option=build_ext --global-option="-I$GRAPHVIZ_DIR/include" --global-option="-L$GRAPHVIZ_DIR/lib" + - name: Install Package Dependencies + run: | + pip install -r requirements.txt + - name: Static Type Checking + run: | + pyright --skipunannotated \ No newline at end of file diff --git a/README.rst b/README.rst index 0e778ea5..70b833e4 100644 --- a/README.rst +++ b/README.rst @@ -146,6 +146,7 @@ Development Dependencies - `invoke `__ - `pre-commit `__ - `pydata-sphinx-theme `__ +- `pyright `__ - `pytest `__ - `pytest-cov `__ - `restructuredtext-lint `__ diff --git a/docs/installation.rst b/docs/installation.rst index b3918ff7..13cb4f49 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -94,6 +94,7 @@ Development Dependencies - `invoke `__ - `pre-commit `__ - `pydata-sphinx-theme `__ +- `pyright `__ - `pytest `__ - `pytest-cov `__ - `restructuredtext-lint `__ diff --git a/pyproject.toml b/pyproject.toml index caec615d..6b6b3dbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ flynt = "*" invoke = "*" pre-commit = "*" pydata-sphinx-theme = "*" +pyright = "*" pytest = "*" pytest-cov = "*" restructuredtext-lint = "*" diff --git a/tasks.py b/tasks.py index 7d2b8909..9cb07e42 100644 --- a/tasks.py +++ b/tasks.py @@ -48,6 +48,7 @@ "ORG", "CONTAINER", "clean", + "quality", "precommit", "tests", "preflight", @@ -140,6 +141,28 @@ def clean( ctx.run(f"rm -rf {pattern}") +@task +def quality( + ctx: Context, + pyright: bool = True, +): + """ + Check the codebase with *Pyright* and lints various *restructuredText* + files with *rst-lint*. + + Parameters + ---------- + ctx + Context. + pyright + Whether to check the codebase with *Pyright*. + """ + + if pyright: + message_box('Checking codebase with "Pyright"...') + ctx.run("pyright --skipunannotated --level warning") + + @task def precommit(ctx: Context): """ @@ -176,7 +199,7 @@ def tests(ctx: Context): ) -@task(precommit, tests) +@task(quality, precommit, tests) def preflight(ctx: Context): # noqa: ARG001 """ Perform the preflight tasks, i.e. *formatting* and *quality*.