Skip to content

Commit

Permalink
ci: fix exception in code snippet, add check to CI (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli authored Jul 15, 2024
1 parent a5276cd commit a98ef54
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/check_docs_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: ci

on:
pull_request:
push:
branches: [main]

jobs:
mkdocs:
strategy:
matrix:
python-version: ["3.11"]
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache multiple paths
uses: actions/cache@v4
with:
path: |
~/.cache/pip
$RUNNER_TOOL_CACHE/Python/*
~\AppData\Local\pip\Cache
key: ${{ runner.os }}-build-${{ matrix.python-version }}
- name: install-reqs
run: python -m pip install --upgrade tox virtualenv setuptools pip -r requirements-dev.txt
- name: install-docs-reqs
run: python -m pip install --upgrade -r docs/requirements-docs.txt
- name: local-install
run: python -m pip install -e .
- name: check-no-errors
run: python -m mkdocs build > output.txt 2>&1
- name: assert-no-errors
run: python utils/check_for_no_build_errors.py
- name: strict-docs-build
run: mkdocs build --strict
2 changes: 2 additions & 0 deletions docs/levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ level of support. If a library implements the
a call such as

```python exec="1" source="above"
from typing import Any

import narwhals as nw
from narwhals.schema import Schema

Expand Down
2 changes: 1 addition & 1 deletion tests/frame/join_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_left_join_multiple_column(request: Any, constructor: Any) -> None:
compare_dicts(result, expected)


@pytest.mark.filterwarnings("ignore: the defaultcoalesce behavior")
@pytest.mark.filterwarnings("ignore: the default coalesce behavior")
def test_left_join_overlapping_column(request: Any, constructor: Any) -> None:
if "pyarrow_table" in str(constructor):
request.applymarker(pytest.mark.xfail)
Expand Down
15 changes: 15 additions & 0 deletions utils/check_for_no_build_errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Check that `output.txt` doesn't contain the string
"exited with errors". If it does, exit with status 1.
This is just used in CI.
"""

import sys

with open("output.txt") as fd:
content = fd.read()

if "exited with errors" in content:
sys.exit(1)
sys.exit(0)

0 comments on commit a98ef54

Please sign in to comment.