feat: TCK expansion, location tracking, and comprehensive CI #42
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # Cancel in-progress runs if a new push is made to the same branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint-and-type: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' # Enable pip caching | |
| - name: Install dependencies | |
| run: | | |
| pip install -e '.[test]' | |
| - name: Check formatting (ruff) | |
| run: ruff format --check . | |
| - name: Lint (ruff) | |
| run: ruff check . | |
| - name: Type check (mypy) | |
| run: mypy src/asciidoctrine | |
| build-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: pip install -e '.[docs]' | |
| - name: Build documentation | |
| run: sphinx-build -W -b html docs/ docs/_build/html | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false # Don't cancel other matrix jobs if one fails | |
| matrix: | |
| python-version: ['3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'vendor/asciidoc-tck/package-lock.json' | |
| - name: Install dependencies | |
| run: | | |
| pip install -e '.[test]' | |
| pip install coverage pytest-cov | |
| - name: Run Core Tests with Coverage | |
| run: | | |
| coverage erase | |
| coverage run --parallel-mode --source=src/asciidoctrine -m pytest --ignore=tests/test_tck.py --ignore=tests/test_doctest_parsing.py | |
| - name: Run TCK with Coverage | |
| run: | | |
| chmod +x run-tck-coverage.sh | |
| ./run-tck-coverage.sh | |
| - name: Run DocTest Parsing with Coverage | |
| run: | | |
| coverage run --parallel-mode --source=src/asciidoctrine -m pytest tests/test_doctest_parsing.py | |
| - name: Combine and Check Coverage | |
| run: | | |
| coverage combine | |
| coverage report --show-missing --fail-under=75 | |
| coverage html # Generate HTML report for artifact | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report-${{ matrix.python-version }} | |
| path: htmlcov/ | |
| if-no-files-found: ignore | |
| test-pyodide: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: | | |
| pip install build pytest-pyodide | |
| - name: Build wheel | |
| run: | | |
| python -m build --wheel | |
| # Download lark dependency into dist directory for pyodide to find it | |
| pip download lark -d dist/ | |
| - name: Run tests under Pyodide | |
| run: | | |
| # Use node runtime for headless CI | |
| pytest --runtime node --dist-dir dist/ tests/test_functional.py |