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
3 changes: 3 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ name: Continuous Delivery
# Commit to master.
# 2. Tag the commit v<version> for a release, or v<version>-pre.<N> for a prerelease.
# 3. Push the tag.
# 4. For a release, deploy its documentation site with `just docs-deploy-latest <version>`
# once this workflow finishes. A patch release redeploys its minor release's x.y.0 docs. See
# "The Documentation Site" in docs/Development.md.
#
# This workflow validates the tag against package.json's version. It runs the test suite. It
# packages the extension. It publishes a GitHub release with the .vsix attached and the matching
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,20 @@ jobs:
with:
name: coverage-report
path: coverage/

# The documentation site, built as `just docs-build` builds it. Deploys stay manual.
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

# A venv, as `just docs-install` makes, since Ubuntu's Python refuses system-wide pip installs.
- name: Install the documentation tools
run: |
python3 -m venv .docsenv
.docsenv/bin/pip install -q -r docs/requirements.txt

# --strict fails the build on any warning, such as a broken link or a missing image.
- name: Build the documentation site
run: .docsenv/bin/mkdocs build --strict
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ tests/manual/build/

# macOS junk
.DS_Store

# The documentation site's venv and build (just docs-install, just docs-build)
.docsenv/
site/
7 changes: 7 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ node_modules
sidecar/**
Justfile
.claude/**
docs/mkdocs/**
docs/overrides/**
docs/requirements.txt
mkdocs.yml
site/**
.docsenv/**
out-validate/**
67 changes: 67 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,70 @@ shell: image
# Remove build output
clean: image
just _run "npm run clean"

# The documentation site's recipes run on the host, in the .docsenv/ Python venv, not the sidecar.
# Deploys push the gh-pages branch with your own Git credentials (see docs/Development.md). The
# site keeps one version per minor release, x.y.0, which each of its patch releases redeploys.

# Run CMD in .docsenv/, which `just docs-install` creates, never in another venv or the sidecar
[private]
_docs CMD:
#!/usr/bin/env bash
set -euo pipefail
if [ "${SIDECAR:-0}" = "1" ]; then
echo "error: the docs recipes run on the host, not in the sidecar" >&2
exit 1
fi
if [ ! -f .docsenv/bin/activate ]; then
echo "error: no .docsenv/; run 'just docs-install' first" >&2
exit 1
fi
source .docsenv/bin/activate
eval "{{CMD}}"

# Refuse a version that isn't a release's x.y.z, or a working tree with uncommitted changes, which mike would publish under HEAD's commit
[private]
_docs-deployable VERSION:
#!/usr/bin/env bash
set -euo pipefail
if ! [[ {{quote(VERSION)}} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "error: a docs version is a release's x.y.z, not "{{quote(VERSION)}} >&2
exit 1
fi
if [ -n "$(git status --porcelain)" ]; then
echo "error: commit or stash your changes first; mike deploys the working tree as HEAD's commit" >&2
exit 1
fi
git fetch -q origin

# Install the documentation site's tools (mkdocs, Material, mike) into .docsenv/, a host Python venv
docs-install:
#!/usr/bin/env bash
set -euo pipefail
[ -d .docsenv ] || python3 -m venv .docsenv
.docsenv/bin/pip install -q --upgrade pip
.docsenv/bin/pip install -q -r docs/requirements.txt

# Build the documentation site into site/, failing on any warning, such as a broken link
docs-build:
just _docs "mkdocs build --strict"

# Serve the documentation site at http://127.0.0.1:8000, rebuilding as pages change
docs-serve:
just _docs "mkdocs serve"

# Browse the deployed versions of the documentation site at http://127.0.0.1:8000
docs-preview:
git fetch -q origin
just _docs "mike serve"

# Deploy a release's documentation to GitHub Pages as its minor release's x.y.0, without moving 'latest', e.g. to revise an older minor release
docs-deploy VERSION: (_docs-deployable VERSION) docs-build
@echo "Deploying {{VERSION}}'s documentation as {{replace_regex(VERSION, '[0-9]+$', '0')}}"
just _docs "mike deploy --push {{replace_regex(VERSION, '[0-9]+$', '0')}}"

# Deploy a release's documentation to GitHub Pages as its minor release's x.y.0, make that 'latest', and have the site's root open 'latest'
docs-deploy-latest VERSION: (_docs-deployable VERSION) docs-build
@echo "Deploying {{VERSION}}'s documentation as {{replace_regex(VERSION, '[0-9]+$', '0')}}, and making it latest"
just _docs "mike deploy --push --update-aliases {{replace_regex(VERSION, '[0-9]+$', '0')}} latest"
just _docs "mike set-default --push latest"
66 changes: 64 additions & 2 deletions docs/Development.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Development

This document is for contributors changing the extension’s own code. It starts with the daily workflow and a pointer to the architecture, which [Architecture.md](Architecture.md) covers in full. Then it covers running and debugging locally, the VS Code tools this work relies on, validation against real Ceedling releases, the manual testing plan, and the Docker sidecar.
This document is for contributors changing the extension’s own code. It starts with the daily workflow and a pointer to the architecture, which [Architecture.md](Architecture.md) covers in full. Then it covers running and debugging locally, the VS Code tools this work relies on, validation against real Ceedling releases, the manual testing plan, the Docker sidecar, and the documentation site.

---

Expand Down Expand Up @@ -315,7 +315,69 @@ There are two modes.
| `just package` | Produces a `.vsix` |
| `just publish` | Publishes to the Marketplace. Requires `VSCE_PAT` |
| `just shell` | Opens an interactive container session |
| `just clean` | Removes build output, the test build, and coverage reports |
| `just clean` | Removes build output, the test build, coverage reports, and the built documentation site |

The documentation site’s `docs-*` recipes run on the host instead. See [Section 8](#8-the-documentation-site).

## 8. The Documentation Site

The extension’s user documentation is a versioned website, published apart from the extension. A docs fix then reaches users without an extension release, which a README can’t do. The site follows the pattern of [Ceedling’s own](https://docs.throwtheswitch.org/Ceedling/).

### How it’s organized

The site lives at <https://docs.throwtheswitch.org/vscode-ceedling/>. [MkDocs](https://www.mkdocs.org/) builds it with the [Material](https://squidfunk.github.io/mkdocs-material/) theme, in Material’s standard colors. [mike](https://github.com/jimporter/mike) versions it, one version per minor release of the extension, named `x.y.0`. Each patch release, `x.y.z`, redeploys its minor release’s version, so that version always holds the newest documentation across its patch releases. The `latest` alias names the newest minor release, and the site’s root opens it. Every other version shows a banner linking to `latest`.

GitHub Pages serves the repository’s `gh-pages` branch, which only mike writes. The organization’s [`throwtheswitch.github.io`](https://github.com/ThrowTheSwitch/throwtheswitch.github.io) repository owns the `docs.throwtheswitch.org` domain, so this repository’s site appears under it at `/vscode-ceedling/`. This repository needs no CNAME file. The repository’s Pages settings must serve the `gh-pages` branch, which an administrator sets once.

- [`mkdocs.yml`](../mkdocs.yml) holds the site’s configuration: its navigation, link validation, theme features, and Markdown extensions.
- `docs/mkdocs/` holds the pages, with their images under `assets/images/`.
- [`docs/overrides/main.html`](overrides/main.html) fills Material’s outdated-version banner.
- [`docs/requirements.txt`](requirements.txt) pins MkDocs, Material, and mike, at the versions Ceedling’s site last deployed with. Their own dependencies aren’t pinned, as Ceedling’s aren’t.

The release-facing documents stay in the repository: the [Changelog](../CHANGELOG.md), [ReleaseNotes.md](ReleaseNotes.md), [KnownIssues.md](KnownIssues.md), and [BreakingChanges.md](BreakingChanges.md). So do this document and [Architecture.md](Architecture.md). Pages link to each on `master`, so they always show its current text. None of the site’s files ship in the `.vsix`, which [`.vscodeignore`](../.vscodeignore) ensures.

### Writing pages

Pages follow the same prose rules as the rest of the documentation. Each page opens with an overview of what it covers. Each section and each paragraph opens with a thesis sentence. Links are reference-style, collected at the bottom of the page, and every page ends with `<br/><br/>`, as Ceedling’s do.

- A card grid is a `<div class="grid cards" markdown>` list. Each card starts with a `:material-<icon>:` shortcode and a bold link, then a `---` line and its summary.
- Content tabs, `=== "Linux"`, hold variants such as one per OS or coverage tool. Choosing a tab chooses the same label in every tab set, on every page.
- Admonitions are Material’s standard types, e.g. `!!! tip` and `!!! warning`.
- `mkdocs build --strict` fails on any warning. `mkdocs.yml` makes every link and navigation problem one, such as a broken link or `#anchor`, a missing image, or a page left out of `nav`. CI’s `docs` job builds the site the same way, on every pull request and every push to `master` or `next_version`.

### Recipes

The documentation recipes run on the host, not in the sidecar, which they refuse. They use a Python virtual environment, `.docsenv/`, which git ignores. It needs Python 3.9 or later. The deploy recipes push with your own Git credentials, which the sidecar lacks.

| Recipe | Does |
|---|---|
| `just docs-install` | Creates `.docsenv/` and installs `docs/requirements.txt` into it |
| `just docs-build` | Builds the site into `site/`, with `--strict` |
| `just docs-serve` | Serves the working tree’s site at <http://127.0.0.1:8000>, rebuilding as pages change |
| `just docs-preview` | Serves the deployed versions from the local `gh-pages` branch, with the version selector |
| `just docs-deploy-latest <version>` | Deploys a release’s documentation as its minor release’s `x.y.0`, moves `latest` to it, and makes the site’s root open `latest` |
| `just docs-deploy <version>` | Deploys a release’s documentation as its minor release’s `x.y.0`, without moving `latest` |

A private `_docs` helper runs each command in `.docsenv/`, and stops when `just docs-install` hasn’t made it yet. Before a deploy, a private `_docs-deployable` helper checks three things:
- the version is a release’s `x.y.z`, which the deploy turns into its minor release’s `x.y.0`;
- the working tree has no changes, since mike would publish them under the commit `HEAD` names;
- `origin` is fetched, since mike fast-forwards the local `gh-pages` from `origin/gh-pages` but never fetches it.

Each deploy then runs `just docs-build`, because mike’s own build isn’t strict. Finally, mike commits the build to the local `gh-pages` and pushes it. `docs-deploy-latest` also runs `mike set-default`, which pushes nothing once `latest` is already the default.

### Deploying

Each release deploys its documentation by hand, as Ceedling does. Run `just docs-deploy-latest <version>` from the release’s tagged commit, once [the release workflow](../.github/workflows/cd.yml) has published it. A patch release, e.g. 2.1.3, replaces its minor release’s 2.1.0 documentation. A `-pre.<N>` prerelease deploys no documentation.

A minor release’s documentation can be revised without a new release.

1. Branch from the minor release’s `docs-x.y.0` tag if it has one, otherwise from the release tag of its newest patch release, `v<version>`.
2. Edit the pages, and check them with `just docs-serve`.
3. Commit the edits.
4. Run `just docs-deploy <version>`, or `just docs-deploy-latest <version>` if it is the newest minor release. Either version of a minor release, e.g. `2.1.0` or `2.1.3`, deploys as `2.1.0`.
5. Point an annotated `docs-x.y.0` tag at the deployed commit, and push the tag. Each minor release’s tag records the source of its deployed documentation. A later patch release’s deploy moves the source on, so move the tag then too.

Changes to the documentation on the integration branch reach the site with the next release.

---

Expand Down
Binary file added docs/mkdocs/assets/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/mkdocs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Ceedling for VS Code

This extension runs your [Ceedling] test suite from VS Code’s built-in _Testing_ view. Its documentation is moving here from the extension’s README.

[Ceedling]: https://docs.throwtheswitch.org/Ceedling/latest/

<br/><br/>
14 changes: 14 additions & 0 deletions docs/overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "base.html" %}

{#
The outdated-version banner. Material's base.html leaves its `outdated` block empty until a
template like this one fills it. Material then shows the banner on every version except the one
that mike's `latest` alias names.
#}

{% block outdated %}
You are not viewing the latest version.
<a href="{{ '../' ~ base_url }}">
<strong>Click here to go to latest.</strong>
</a>
{% endblock %}
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# The documentation site's tools, pinned to the versions Ceedling's own site last deployed with.
# `just docs-install` installs them into .docsenv/, and CI's docs job into a venv of its own.
mkdocs==1.6.1
mkdocs-material==9.7.6
mike==2.2.0
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import tseslint from 'typescript-eslint';

export default defineConfig(
{
ignores: ['out/', 'out-test/', 'coverage/', '.vscode-test/', 'node_modules/', 'tests/manual/', 'tests/fixtures/'],
ignores: ['out/', 'out-test/', 'coverage/', '.vscode-test/', 'node_modules/', 'tests/manual/', 'tests/fixtures/', 'site/', '.docsenv/'],
},
js.configs.recommended,
{
Expand Down
88 changes: 88 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# The extension's user documentation site, built from docs/mkdocs/ and versioned with mike, one
# version per extension release. `just docs-build` builds it, and docs/Development.md explains
# deploying it. Ceedling's own site (ThrowTheSwitch/Ceedling) set the pattern.

# Site metadata
site_name: VSCode-Ceedling
site_description: Ceedling's test suite in Visual Studio Code's Testing view
site_url: https://docs.throwtheswitch.org/vscode-ceedling/
repo_url: https://github.com/ThrowTheSwitch/vscode-ceedling
repo_name: ThrowTheSwitch/vscode-ceedling

docs_dir: docs/mkdocs/

# Every problem MkDocs can find in links and nav is a warning, which --strict turns into a failed
# build. By default, a broken #anchor, an absolute or unrecognized link, and a page missing from
# nav are only reported.
validation:
nav:
omitted_files: warn
not_found: warn
absolute_links: warn
links:
not_found: warn
anchors: warn
absolute_links: warn
unrecognized_links: warn

# Material theme configuration, in its standard colors
theme:
name: material
favicon: assets/images/favicon.png
custom_dir: docs/overrides # Template overrides (the outdated-version banner)
features:
- navigation.tabs # Top-level nav rendered as tabs
- navigation.sections # Sections rendered as groups in left sidebar
- navigation.top # Back-to-top button
- navigation.indexes # Section index pages (first item in section = section landing page)
- navigation.path # Breadcrumb trail below page title
- navigation.instant # Instant navigation with page content swaps (without page reloads)
- search.suggest # Autocomplete suggestions in search
- search.highlight # Highlight search terms on result pages
- content.code.copy # Copy button on code blocks
- content.code.annotate # Inline annotation support in code blocks
- content.tabs.link # Choosing a tab (e.g. an OS) chooses it in every tab set on the site

# Extra site configuration
extra:
generator: false # Suppress "Made with Material for MkDocs" footer text
version:
provider: mike # Versioned documentation deployment via mike
default: latest
social:
- icon: fontawesome/brands/github
link: https://github.com/sponsors/ThrowTheSwitch
name: Sponsor ThrowTheSwitch on GitHub

# Plugins
plugins:
- search # Full-text search index
- mike: # Versioned documentation deployment to gh-pages
alias_type: symlink
canonical_version: latest

# Markdown extensions
markdown_extensions:
- toc:
toc_depth: 3 # Limits TOC to show headings H1 through H3
# (H2 and H3 in reality since H1 is reserved for page titles)
- admonition # !!! note / tip / warning / etc. callout blocks
- md_in_html # Markdown inside raw HTML elements (required for card grids)
- footnotes
- pymdownx.emoji: # Emoji shortcodes (:material-icon:, :fontawesome-icon:, etc.)
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.highlight: # Syntax highlighting for fenced code blocks via Pygments
use_pygments: true
anchor_linenums: true
- pymdownx.superfences: # Fenced code blocks inside admonitions, tabs, and other nested elements
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.inlinehilite # Inline code syntax highlighting with `#!lang code` syntax
- pymdownx.tabbed: # === "Linux" content tabs, e.g. one per OS or coverage tool
alternate_style: true

nav:
- Home: index.md
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"main": "out/src/main.js",
"scripts": {
"clean": "rimraf out out-test coverage *.vsix",
"clean": "rimraf out out-test coverage site *.vsix",
"vscode:prepublish": "npm run -S esbuild-base -- --minify",
"esbuild-base": "rimraf out && esbuild ./src/main.ts --bundle --outfile=out/src/main.js --external:vscode --format=cjs --platform=node",
"build": "npm run -S esbuild-base -- --sourcemap",
Expand Down
2 changes: 1 addition & 1 deletion sidecar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The image holds none of the repository. The checkout is bind-mounted when a cont

## Using it through the Justfile

Every interaction goes through the root `Justfile`. `just --list` shows its recipes: `install`, `build`, `watch`, `rebuild`, `test`, `lint`, `coverage`, `validate`, `validate-matrix`, `package`, `publish`, `clean`, `shell`, and `image`. Don’t run `docker` directly. The recipes handle image builds, volume mounts, and environment forwarding consistently.
Every interaction goes through the root `Justfile`. `just --list` shows its recipes: `install`, `build`, `watch`, `rebuild`, `test`, `lint`, `coverage`, `validate`, `validate-matrix`, `package`, `publish`, `clean`, `shell`, and `image`. Don’t run `docker` directly. The recipes handle image builds, volume mounts, and environment forwarding consistently. `just --list` also shows the documentation site’s `docs-*` recipes. Those run on the host in a Python venv instead, as [docs/Development.md](../docs/Development.md#8-the-documentation-site) explains.

Recipes run in one of two modes.

Expand Down
Loading