Skip to content

Commit db5c519

Browse files
authored
Merge branch 'ClickHouse:main' into experiment_vertical_stepper
2 parents 6512d08 + 501ae85 commit db5c519

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+5348
-335
lines changed

.github/workflows/trigger-build.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/vale-linter.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Style check
2+
3+
on:
4+
pull_request:
5+
types:
6+
- synchronize
7+
- reopened
8+
- opened
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
vale:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 10
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
path: .
27+
28+
- name: Install Vale
29+
run: |
30+
sudo snap install vale
31+
vale -v # Verify installation
32+
33+
- name: Set up Python
34+
run: |
35+
curl -Ls https://astral.sh/uv/install.sh | sh
36+
uv python install 3.12
37+
38+
- name: Log changed lines
39+
run: |
40+
# Make sure script is executable
41+
chmod +x scripts/vale/changed_lines_to_json.py
42+
43+
# Run the script to get changed lines
44+
python scripts/vale/changed_lines_to_json.py ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
45+
46+
# Check if the report was created
47+
if [ -f "logs/changed_lines.json" ]; then
48+
echo "Changed lines log generated successfully."
49+
else
50+
echo "Error: Failed to generate changed lines report."
51+
exit 1
52+
fi
53+
54+
- name: Run vale on changed files
55+
run: |
56+
# Extract file names from the JSON report
57+
CHANGED_FILES=$(cat logs/changed_lines.json | jq -r '.[].filename' | tr '\n' ' ')
58+
59+
# Check if we have any files to process
60+
if [ -z "$CHANGED_FILES" ]; then
61+
echo "No changed files to analyze"
62+
exit 0
63+
fi
64+
65+
echo "Running Vale on: $CHANGED_FILES"
66+
vale --config='.vale.ini' \
67+
${CHANGED_FILES} \
68+
--output=scripts/vale/vale_output_template.tmpl --no-exit > logs/vale_output.log
69+
70+
- name: Parse Vale output
71+
run: |
72+
# Read the changed_lines.json to get line numbers
73+
CHANGED_LINES=$(cat logs/changed_lines.json)
74+
75+
# Run the parser script
76+
python scripts/vale/vale_annotations.py --git-log-file="logs/changed_lines.json" --vale-log-file="logs/vale_output.log"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ docs/about-us/beta-and-experimental-features.md
5757

5858
**.translated
5959
**.translate
60-
ClickHouse/
60+
/ClickHouse/
6161

6262

6363
# Ignore table of contents files

.vale.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
StylesPath = styles
2+
MinAlertLevel = suggestion
3+
4+
[*.{md}]
5+
BasedOnStyles = ClickHouse

contribute/contrib-writing-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ sudo apt-get install npm
4343
sudo npm install --global yarn
4444
```
4545

46-
note: if the Node version available in your distro is old (`<=v16`), you can use [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) to pick a specific one.
46+
Note: if the Node version available in your distro is old (`<=v16`), you can use [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) to pick a specific one.
4747

4848
for example to use the appropriate version of node:
4949

contribute/style-guide.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,128 @@ should pass. Finally open another PR on the docs repo again to remove the
251251
file from the exception list and add it to `sidebars.js` in the appropriate
252252
sidebar.
253253

254+
## Client versioning
255+
256+
### Background
257+
258+
Docusaurus supports versioning documentation, however it is opinionated and
259+
aimed more at use cases where you have a single product with set releases, or
260+
multiple products with their own releases.
261+
262+
Due to the fact that we have many different integrations in ClickHouse, each of
263+
which may need versioned documentation, we use the following custom
264+
`ClientVersionDropdown` component for versioning of client documentation:
265+
266+
```markdown
267+
<ClientVersionDropdown versions={}/>
268+
```
269+
270+
### How to use it
271+
272+
Versioned folders are structured as follows:
273+
274+
```text
275+
.
276+
├── client
277+
│ ├── _snippets
278+
│ │ ├── _v0_7.mdx
279+
│ │ └── _v0_8.mdx
280+
│ └── client.mdx
281+
├── index.md
282+
├── jdbc
283+
│ ├── _snippets
284+
│ │ ├── _v0_7.mdx
285+
│ │ └── _v0_8.mdx
286+
│ └── jdbc.mdx
287+
└── r2dbc.md
288+
```
289+
290+
* The content for each version is placed in a snippet. For example `_v0_7.mdx`
291+
* Snippets begin with `_`
292+
* Snippets do not contain front-matter
293+
* These snippets import any components they may need (See `_v0_7.mdx` for example)
294+
* They should be .mdx files
295+
* There is a single page for all versions. For example `client.mdx`
296+
* This page contains frontmatter
297+
* It imports the `<ClientVersionDropdown>` component
298+
* It should be a .mdx file
299+
300+
To use this component, import it into the single page:
301+
302+
```js
303+
import ClientVersionDropdown from '@theme/ClientVersionDropdown/ClientVersionDropdown'
304+
```
305+
306+
Also import the two snippets:
307+
308+
```js
309+
import v07 from './_v0_7.mdx'
310+
import v08 from './_v0_8.mdx'
311+
```
312+
313+
Pass it an array of objects representing versions and their respective snippets:
314+
315+
```markdown
316+
<ClientVersionDropdown versions={[
317+
{
318+
'version': 'v0.8+',
319+
'snippet': v08
320+
},
321+
{
322+
'version': 'v0.7.x',
323+
'snippet': v07
324+
}
325+
]}/>
326+
```
327+
328+
**Note**: The component will display the first item as the 'selected' version, so
329+
it is important to make sure the order of the objects is correct.
330+
331+
### URL parameters
332+
333+
If you need to share a link to the page you can do it through URL params:
334+
335+
```response
336+
/docs/integrations/language-clients/java/client?v=v08
337+
```
338+
339+
When using URL parameters to control which version of documentation is displayed,
340+
there are conventions to follow for reliable functionality.
341+
Here's how the `?v=v08` parameter relates to the snippet selection:
342+
343+
#### How It Works
344+
345+
The URL parameter acts as a selector that matches against the `version` property
346+
in your component configuration. For example:
347+
348+
- URL: `docs/api?v=v08`
349+
- Matches: `version: 'v0.8+'` in your dropdown configuration
350+
351+
#### Conventions That Work
352+
353+
- **Simple Version Strings**: Parameters like `?v=v08`, `?v=v07` work by
354+
- matching against stripped versions of your configured version names.
355+
356+
- **Flexible Matching**: The implementation supports:
357+
- Removing dots: `v0.8` matches `?v=v08`
358+
- Ignoring plus signs: `v0.8+` matches `?v=v08`
359+
- Case-insensitive matching: `v0.8` matches `?v=V08`
360+
361+
- **Preserving Other Parameters**: Other URL parameters are preserved when
362+
switching versions.
363+
364+
#### What Won't Work
365+
366+
- **Partial Matches**: `?v=8` won't match `v0.8` with the default implementation.
367+
368+
- **Complex Version Strings**: Very complex versions like `?v=v1.2.3-beta.4`
369+
require more sophisticated matching logic. (Reach out to the docs team if required)
370+
371+
- **Non-Standard Formats**: Version formats not accounted for in the matching
372+
logic might fail.
373+
374+
#### Best Practices
375+
376+
1. Keep version strings in consistent formats for predictable results.
377+
378+
2. Use simplified version parameters in URLs (e.g., `v08` instead of `v0.8.x`).

0 commit comments

Comments
 (0)