Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 76 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ on:
workflow_dispatch:

jobs:
lint:
name: Lint and format
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install ruff
run: python -m pip install --upgrade pip && python -m pip install ruff

- name: Check lint rules
run: ruff check doc_engine/ tests/

- name: Check formatting
run: ruff format --check doc_engine/ tests/

test:
name: ${{ matrix.os }} · Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -61,6 +83,59 @@ jobs:
mkdir -p "$RUNNER_TEMP/smoke" && cd "$RUNNER_TEMP/smoke"
doc-engine --version
doc-engine info
printf -- '---\ntitle: Smoke\naccent: teal\n---\n\n# Smoke\n\nText with a footnote[^1], a bracket ], and a task.\n\n- [x] done\n\n[^1]: note\n' > README.md
doc-engine --help
{
echo '---'
echo 'title: Smoke'
echo 'accent: teal'
echo '---'
echo
echo '# Smoke'
echo
echo 'A footnote[^1], a bracket ], a task, $10 in cash, and math $x^2$.'
echo
echo '- [x] done'
echo
echo '| A | B |'
echo '|---|---|'
echo '| 1 | 2 |'
echo
echo '```mermaid'
echo 'flowchart LR'
echo ' A-->B'
echo '```'
echo
echo '$$'
echo '\frac{-b \pm \sqrt{b^2-4ac}}{2a}'
echo '$$'
echo
echo '[^1]: note'
} > README.md
doc-engine build
test -f README_doc.pdf
doc-engine build --paper us-letter --template report --pdf-standard a-2b -o archival.pdf
test -f archival.pdf

docker:
name: Docker image builds
runs-on: ubuntu-latest

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

- name: Build the image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: doc-engine-cli:ci

- name: Run the CLI inside it
run: |
mkdir -p "$RUNNER_TEMP/docker-smoke"
printf '# Docker\n\nText and math $x^2$.\n\n```mermaid\nflowchart LR\n A-->B\n```\n' \
> "$RUNNER_TEMP/docker-smoke/README.md"
docker run --rm -v "$RUNNER_TEMP/docker-smoke:/workspace" doc-engine-cli:ci build
test -f "$RUNNER_TEMP/docker-smoke/README_doc.pdf"
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,16 @@ passes after it — that is what stops the same bug from coming back.

## Code style

There is no autoformatter in this project. Match the surrounding code:
Formatting and linting are handled by [ruff](https://docs.astral.sh/ruff/), and
CI checks both. Before opening a pull request:

```bash
ruff format doc_engine/ tests/
ruff check doc_engine/ tests/
```

Ruff settles the mechanical questions. The rest is convention — match the
surrounding code:

- Type hints on function signatures.
- Module-level constants in `SCREAMING_SNAKE_CASE`, prefixed with `_` when private.
Expand Down
Loading
Loading