Skip to content

Commit

Permalink
Merge pull request #4 from eli64s/feature/markdown-link-validator
Browse files Browse the repository at this point in the history
feat: Markdown Link Validator
  • Loading branch information
eli64s authored Jan 8, 2025
2 parents 24d4c62 + 6543fb5 commit 0c53028
Show file tree
Hide file tree
Showing 17 changed files with 669 additions and 374 deletions.
220 changes: 110 additions & 110 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,66 +20,66 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version-file: pyproject.toml

- name: Install dependencies
run: |
uv sync --all-extras --group test
- name: Create report directories
run: |
mkdir -p tests/.reports
- name: Run tests with coverage
run: |
uv run pytest \
-vv \
--tb=short \
--durations=5 \
--cov=src/splitme_ai \
--cov-branch \
--cov-fail-under=0 \
--cov-report=term-missing:skip-covered \
--cov-report=json:tests/.reports/coverage.json \
--asyncio-mode=auto \
--numprocesses=auto
- name: Verify coverage report
run: |
ls -la tests/.reports/coverage.json
echo "Coverage report size: $(stat -f%z tests/.reports/coverage.json)"
echo "Coverage report content preview:"
head -n 20 tests/.reports/coverage.json
continue-on-error: true

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tests/.reports/coverage.json
flags: unittests-${{ matrix.python-version }}
name: Python ${{ matrix.python-version }}
fail_ci_if_error: true
directory: tests/.reports
verbose: true
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version-file: pyproject.toml

- name: Install dependencies
run: |
uv sync --all-extras --group test
- name: Create report directories
run: |
mkdir -p tests/.reports
- name: Run tests with coverage
run: |
uv run pytest \
-vv \
--tb=short \
--durations=5 \
--cov=src/splitme_ai \
--cov-branch \
--cov-fail-under=0 \
--cov-report=term-missing:skip-covered \
--cov-report=json:tests/.reports/coverage.json \
--asyncio-mode=auto \
--numprocesses=auto
- name: Verify coverage report
run: |
ls -la tests/.reports/coverage.json
echo "Coverage report size: $(stat -f%z tests/.reports/coverage.json)"
echo "Coverage report content preview:"
head -n 20 tests/.reports/coverage.json
continue-on-error: true

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tests/.reports/coverage.json
flags: unittests-${{ matrix.python-version }}
name: Python ${{ matrix.python-version }}
fail_ci_if_error: true
directory: tests/.reports
verbose: true

build:
name: Build Package
Expand All @@ -88,29 +88,29 @@ jobs:
if: success() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Build package
run: |
uv pip install --system build hatch
hatch build
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Build package
run: |
uv pip install --system build hatch
hatch build
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

docs:
name: Build Documentation
Expand All @@ -119,32 +119,32 @@ jobs:
if: success() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Install dependencies
run: |
uv sync --all-extras --group docs
- name: Install dependencies
run: |
uv sync --all-extras --group docs
- name: Build documentation
run: |
uv run mkdocs build
- name: Build documentation
run: |
uv run mkdocs build
- name: Store documentation
uses: actions/upload-artifact@v4
with:
name: site
path: site/
- name: Store documentation
uses: actions/upload-artifact@v4
with:
name: site
path: site/

deploy:
name: Deploy to PyPI
Expand All @@ -158,11 +158,11 @@ jobs:
id-token: write

steps:
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,4 @@ site/
docs/integrations/
docs/notes.md
docs/roadmap.md
src/splitme_ai/tools/
src/splitme_ai/tools
tests/data/readme-ai.html
76 changes: 48 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
SHELL := /bin/bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules

# Project
PY_VERSION := 3.11
TARGET := src tests
TOML_FILE := pyproject.toml
PYTHON_VERSION := 3.11
PYPROJECT := pyproject.toml
TARGET := splitme_ai tests
TARGET_TEST := tests

# Tools
UV := uv
UVX := uvx --isolated
UV_PIP := $(UV) pip
UV_RUN := $(UV) run
UV_SYNC := $(UV) sync

# -- Clean Up ------------------------------------------------------------------

Expand All @@ -32,71 +31,92 @@ build-hatch: ## Build the distribution package using hatch
.PHONY: build
build: ## Build the distribution package using uv
uv build
$(UV_PIP) install dist/splitme_ai-0.1.0-py3-none-any.whl
uv pip install dist/splitme_ai-0.1.0-py3-none-any.whl

.PHONY: install
install: ## Install all dependencies from pyproject.toml
$(UV_SYNC) --dev --group test --group docs --group lint --all-extras
uv sync --dev --group test --group docs --group lint --all-extras

.PHONY: lock
lock: ## Lock dependencies declared in pyproject.toml
$(UV_PIP) compile pyproject.toml --all-extras
uv pip compile pyproject.toml --all-extras

.PHONY: requirements
requirements: ## Generate requirements files from pyproject.toml
$(UV_PIP) compile pyproject.toml -o requirements.txtiu
$(UV_PIP) compile pyproject.toml --all-extras -o requirements-dev.txt
uv pip compile pyproject.toml -o requirements.txtiu
uv pip compile pyproject.toml --all-extras -o requirements-dev.txt

.PHONY: sync
sync: ## Sync environment with pyproject.toml
$(UV_SYNC) --all-groups --dev
uv sync --all-groups --dev

.PHONY: update
update: ## Update all dependencies from pyproject.toml
uv lock --upgrade

.PHONY: venv
venv: ## Create a virtual environment
uv venv --python $(PY_VERSION)
uv venv --python $(PYTHON_VERSION)


# -- Documentation --------------------------------------------------------------

.PHONY: docs
docs: ## Build documentation site using mkdocs
$(UV_RUN) mkdocs serve
# uvx --with mkdocs-material mkdocs serve
cd docs && \
uv run mkdocs build --clean
uv run mkdocs serve


# -- Linting ---------------------------------------------------------------

.PHONY: format-toml
format-toml: ## Format TOML files using pyproject-fmt
$(UVX) pyproject-fmt $(TOML_FILE) --indent 4
uvx --isolated pyproject-fmt $(TOML_FILE) --indent 4

.PHONY: format
format: ## Format Python files using Ruff
@echo -e "\n► Running the Ruff formatter..."
$(UVX) ruff format $(TARGET) --config .ruff.toml
uvx --isolated ruff format $(TARGET) --config .ruff.toml

.PHONY: lint
lint: ## Lint Python files using Ruff
@echo -e "\n ►Running the Ruff linter..."
$(UVX) ruff check $(TARGET) --fix --config .ruff.toml
uvx --isolated ruff check $(TARGET) --fix --config .ruff.toml

.PHONY: format-and-lint
format-and-lint: format lint ## Format and lint Python files

.PHONY: mypy
mypy: ## Type-check Python files using MyPy
$(UV_RUN) mypy $(TARGET)
.PHONY: typecheck-mypy
typecheck-mypy: ## Type-check Python files using MyPy
uv run mypy $(TARGET)

.PHONY: typecheck-pyright
typecheck-pyright: ## Type-check Python files using Pyright
uv run pyright $(TARGET)


.PHONY: pyright
pyright: ## Type-check Python files using Pyright
$(UV_RUN) pyright $(TARGET)
# -- Testing -------------------------------------------------------------------

.PHONY: test
test: ## Run test suite using Pytest
poetry run pytest $(TARGET_TEST) --config-file $(PYPROJECT)


# -- Utilities ------------------------------------------------------------------

.PHONY: run-pypi
run-pypi:
uvx --isolated splitme-ai --split.i tests/data/readme-ai.md --split.settings.o .splitme-ai/pypi-h2/ --split.settings.hl "##"
uvx --isolated splitme-ai --split.i tests/data/readme-ai.md --split.settings.o .splitme-ai/pypi-h3/ --split.settings.hl "###"
uvx --isolated splitme-ai --split.i tests/data/readme-ai.md --split.settings.o .splitme-ai/pypi-h4/ --split.settings.hl "####"

.PHONY: run-splitter
run-splitter: ## Run the main application
uv run splitme-ai --split.i tests/data/readme-ai.md --s.settings.o .splitme-ai/test-docs-h2/ --s.settings.hl "##" --s.settings.mkdocs
uv run splitme-ai --split.i tests/data/readme-ai.md --s.settings.o .splitme-ai/test-docs-h3/ --s.settings.hl "###"
uv run splitme-ai --split.i tests/data/readme-ai.md --s.settings.o .splitme-ai/test-docs-h4/ --s.settings.hl "####"

.PHONY: help
help: ## Display this help
@echo ""
Expand Down
Loading

0 comments on commit 0c53028

Please sign in to comment.