Skip to content

Commit 365e9a4

Browse files
authored
Merge pull request #225 from per1234/website
Sync website assets from templates
2 parents 3b32708 + 8a06ac3 commit 365e9a4

22 files changed

+434
-550
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-mkdocs-task.md
2+
name: Check Website
3+
4+
env:
5+
# See: https://github.com/actions/setup-go/tree/v2#readme
6+
GO_VERSION: "1.14"
7+
# See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python
8+
PYTHON_VERSION: "3.9"
9+
10+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
11+
on:
12+
push:
13+
paths:
14+
- ".github/workflows/check-mkdocs-task.ya?ml"
15+
- "Taskfile.ya?ml"
16+
- "mkdocs.ya?ml"
17+
- "poetry.lock"
18+
- "pyproject.toml"
19+
- "docs/**"
20+
- "docsgen/**"
21+
- "**.go"
22+
pull_request:
23+
paths:
24+
- ".github/workflows/check-mkdocs-task.ya?ml"
25+
- "Taskfile.ya?ml"
26+
- "mkdocs.ya?ml"
27+
- "poetry.lock"
28+
- "pyproject.toml"
29+
- "docs/**"
30+
- "docsgen/**"
31+
- "**.go"
32+
workflow_dispatch:
33+
repository_dispatch:
34+
35+
jobs:
36+
check:
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
42+
43+
- name: Install Go
44+
uses: actions/setup-go@v2
45+
with:
46+
go-version: ${{ env.GO_VERSION }}
47+
48+
- name: Install Python
49+
uses: actions/setup-python@v2
50+
with:
51+
python-version: ${{ env.PYTHON_VERSION }}
52+
53+
- name: Install Poetry
54+
run: pip install poetry
55+
56+
- name: Install Task
57+
uses: arduino/setup-task@v1
58+
with:
59+
repo-token: ${{ secrets.GITHUB_TOKEN }}
60+
version: 3.x
61+
62+
- name: Build website
63+
run: task website:check

.github/workflows/check-python-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check Python
22

33
env:
44
# See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python
5-
PYTHON_VERSION: "3.8"
5+
PYTHON_VERSION: "3.9"
66

77
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
88
on:
Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
name: Publish documentation
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md
2+
name: Deploy Website
23

34
on:
45
push:
56
branches:
7+
# Branch to base "dev" website on. Set in siteversion.py also.
68
- main
79
# Release branches have names like 0.8.x, 0.9.x, ...
810
- "[0-9]+.[0-9]+.x"
911
paths:
1012
- "docs/**"
13+
- ".github/workflows/deploy-cobra-mkdocs-versioned-poetry.ya?ml"
14+
- "go.mod"
15+
- "go.sum"
16+
- "Taskfile.ya?ml"
17+
- "**.go"
1118
- "docsgen/**"
12-
- "cli/**"
13-
- ".github/workflows/publish-docs.yml"
19+
- "mkdocs.ya?ml"
20+
- "poetry.lock"
21+
- "pyproject.toml"
1422
# Run on branch or tag creation (will be filtered by the publish-determination job).
1523
create:
1624

@@ -38,46 +46,45 @@ jobs:
3846
if: needs.publish-determination.outputs.result == 'true'
3947

4048
steps:
41-
- name: Checkout local repository
49+
- name: Checkout repository
4250
uses: actions/checkout@v2
4351

44-
- name: Install Taskfile
45-
uses: arduino/setup-task@v1
46-
with:
47-
repo-token: ${{ secrets.GITHUB_TOKEN }}
48-
version: 3.x
49-
50-
- name: Install Go
51-
uses: actions/setup-go@v2
52-
with:
53-
go-version: "1.14"
54-
5552
- name: Install Python
5653
uses: actions/setup-python@v2
5754
with:
58-
python-version: "3.8"
59-
60-
- name: Cache dependencies
61-
uses: actions/cache@v2
62-
with:
63-
path: ~/.cache/pip
64-
key: ${{ runner.os }}-pip-${{ hashFiles('./pyproject.toml') }}
65-
restore-keys: |
66-
${{ runner.os }}-pip-
55+
python-version: "3.9"
6756

6857
- name: Install Poetry
6958
run: |
7059
python -m pip install --upgrade pip
7160
python -m pip install poetry
7261
62+
- name: Install Task
63+
uses: arduino/setup-task@v1
64+
with:
65+
repo-token: ${{ secrets.GITHUB_TOKEN }}
66+
version: 3.x
67+
68+
- name: Create all generated documentation content
69+
run: task docs:generate
70+
7371
- name: Install Python dependencies
7472
run: poetry install --no-root
7573

74+
- name: Determine versioning parameters
75+
id: determine-versioning
76+
run: echo "::set-output name=data::$(poetry run python docs/siteversion/siteversion.py)"
77+
7678
- name: Publish documentation
77-
# Determine docs version for the commit pushed and publish accordingly using Mike.
78-
# Publishing implies creating a git commit on the gh-pages branch, we let @ArduinoBot own these commits.
79+
if: fromJson(steps.determine-versioning.outputs.data).version != null
7980
run: |
81+
# Publishing implies creating a git commit on the gh-pages branch, we let @ArduinoBot own these commits.
8082
git config --global user.email "bot@arduino.cc"
8183
git config --global user.name "ArduinoBot"
8284
git fetch --no-tags --prune --depth=1 origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages
83-
poetry run python docs/build.py
85+
poetry run mike deploy \
86+
--update-aliases \
87+
--push \
88+
--remote origin \
89+
${{ fromJson(steps.determine-versioning.outputs.data).version }} \
90+
${{ fromJson(steps.determine-versioning.outputs.data).alias }}

.github/workflows/spell-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install Python
1919
uses: actions/setup-python@v2
2020
with:
21-
python-version: "3.8"
21+
python-version: "3.9"
2222

2323
- name: Install Poetry
2424
run: pip install poetry

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
- name: Install Python
7676
uses: actions/setup-python@v2
7777
with:
78-
python-version: "3.8"
78+
python-version: "3.9"
7979

8080
- name: Install Poetry
8181
run: pip install poetry

.github/workflows/validate-docs.yml

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

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
[![Publish Nightly Build status](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-nightly-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-nightly-task.yml)
66
[![Check Python status](https://github.com/arduino/arduino-lint/actions/workflows/check-python-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-python-task.yml)
77
[![Check Markdown status](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml)
8-
[![Docs Status](https://github.com/arduino/arduino-lint/workflows/Publish%20documentation/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Publish+documentation)
8+
[![Check Website status](https://github.com/arduino/arduino-lint/actions/workflows/check-mkdocs-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-mkdocs-task.yml)
9+
[![Deploy Website status](https://github.com/arduino/arduino-lint/actions/workflows/deploy-cobra-mkdocs-versioned-poetry.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/deploy-cobra-mkdocs-versioned-poetry.yml)
910
[![Codecov](https://codecov.io/gh/arduino/arduino-lint/branch/main/graph/badge.svg?token=nprqPQMbdh)](https://codecov.io/gh/arduino/arduino-lint)
1011
[![Check Prettier Formatting status](https://github.com/arduino/arduino-lint/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-prettier-formatting-task.yml)
1112
[![Check General Formatting status](https://github.com/arduino/arduino-lint/actions/workflows/check-general-formatting-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-general-formatting-task.yml)

Taskfile.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -226,40 +226,40 @@ tasks:
226226
cmds:
227227
- poetry run black .
228228

229+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
229230
docs:generate:
230231
desc: Create all generated documentation content
231232
deps:
232-
- task: docs:gen
233+
- task: go:cli-docs
234+
# Make the formatting consistent with the non-generated Markdown
235+
- task: general:format-prettier
233236

234-
docs:gen:
235-
desc: Generate command reference
237+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
238+
go:cli-docs:
239+
desc: Generate command line interface reference documentation
236240
dir: ./docsgen
237241
cmds:
238-
# docs will generate examples using os.Args[0] so we need to call
239-
# the generator `arduino-lint`
240-
- go build -o arduino-lint{{exeExt}}
241-
# we invoke `arduino-lint` like this instead of `./arduino-lint` to remove
242-
# the `./` chars from the examples
243-
- PATH=. arduino-lint ../docs/commands
244-
- task: general:format-prettier
242+
# Command examples use os.Args[0] so the docs generation binary must have the same filename as the project
243+
- go build -o {{.PROJECT_NAME}}{{exeExt}}
244+
# The binary is invoked like this instead of `./{{.PROJECT_NAME}}` to remove the `./` chars from the examples
245+
- PATH=. {{.PROJECT_NAME}} ../docs/commands
245246

246-
docs:build:
247-
desc: Build documentation website contents
247+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
248+
website:check:
249+
desc: Check whether the MkDocs-based website will build
250+
deps:
251+
- task: docs:generate
252+
- task: poetry:install-deps
248253
cmds:
249-
- task: docs:gen
250-
- poetry install --no-root
251254
- poetry run mkdocs build --strict
252255

253-
docs:publish:
254-
desc: Use Mike to build and push versioned docs
255-
cmds:
256-
- task: docs:gen
257-
- poetry run mike deploy --update-aliases --push --remote {{.DOCS_REMOTE}} {{.DOCS_VERSION}} {{.DOCS_ALIAS}}
258-
259-
docs:serve:
260-
desc: Run documentation website locally
256+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
257+
website:serve:
258+
desc: Run website locally
259+
deps:
260+
- task: docs:generate
261+
- task: poetry:install-deps
261262
cmds:
262-
- task: docs:build
263263
- poetry run mkdocs serve
264264

265265
docs:check:

docs/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ To build Arduino Lint from sources you need the following tools to be available
8181

8282
If you want to run integration tests or work on documentation, you will also need:
8383

84-
- A working [Python](https://www.python.org/downloads/) environment, version 3.8 or later.
84+
- A working [Python](https://www.python.org/downloads/) environment, version 3.9 or later.
8585
- [Poetry](https://python-poetry.org/docs/).
8686

8787
### Building the source code
@@ -232,7 +232,7 @@ documentation website. You can build the documentation website and serve it from
232232
command:
233233

234234
```
235-
task docs:serve
235+
task website:serve
236236
```
237237

238238
The documentation will build. If you don't see any error, open `http://127.0.0.1:8000` in your browser to local the
@@ -254,7 +254,7 @@ Otherwise you can use the following tasks. To do so you'll need to install `npm`
254254
To check if the files are correctly formatted run:
255255

256256
```shell
257-
task docs:check
257+
task website:check
258258
```
259259

260260
If the output tells you that some files are not formatted correctly run:

0 commit comments

Comments
 (0)