Skip to content

Sync website assets from templates #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1b86ed3
Remove superfluous comments from MkDocs config file
per1234 Aug 3, 2021
f2ce3ae
Add reference comment to MkDocs configuration file
per1234 Aug 3, 2021
83b695b
Add edit links to website pages
per1234 Aug 3, 2021
3e8db8b
Alphabeticize extensions list in MkDocs configuration file
per1234 Aug 3, 2021
4759586
Use standardized page title for website home page
per1234 Aug 3, 2021
b7df072
Update Python version used for project development to 3.9
per1234 Aug 4, 2021
4e4753a
Update website generation dependencies
per1234 Aug 4, 2021
4bb83d6
Use standardized filename for website publishing workflow
per1234 Aug 4, 2021
3961182
Use standardized name for command reference generation task
per1234 Aug 4, 2021
1073711
Use standardized job/step names in "Deploy Website" workflow
per1234 Aug 4, 2021
8afb9dc
Always use `docs:generate` task for documentation generation
per1234 Aug 4, 2021
aaa17b4
Use standardized `go:cli-docs` task description
per1234 Aug 4, 2021
3f82e64
Use taskfile variable in place of hardcoded project name
per1234 Aug 4, 2021
5798966
Update to new website versioning system
per1234 Aug 4, 2021
9afdaa1
Expand "Deploy Website" workflow's paths filter to cover all relevant…
per1234 Aug 4, 2021
dd9dcc1
Order "Deploy Website" workflow's steps according to the template
per1234 Aug 4, 2021
0b16b1c
Remove Python dependencies caching step
per1234 Aug 4, 2021
e72436f
Remove project-specific references from "docsgen" program's comments
per1234 Aug 4, 2021
fa0506f
Generate the Cobra docs output folder on demand
per1234 Aug 4, 2021
6199041
Use standardized name for website check tasks
per1234 Aug 4, 2021
49854d2
Use standardized descriptions for website check tasks
per1234 Aug 4, 2021
2e5218d
Use Python dependency installation task in `website:check`
per1234 Aug 4, 2021
0c066bb
Move dependencies to the `website:check` task's `deps` key
per1234 Aug 4, 2021
2f257e8
Avoid redundant website build in `website:serve` task
per1234 Aug 4, 2021
5a790c2
Use standardized filename for website check workflow
per1234 Aug 4, 2021
50d953b
Use standardized workflow/job/step names in website check workflow
per1234 Aug 4, 2021
86a8a03
Expand "Check Website" workflow's paths filter to cover all relevant …
per1234 Aug 4, 2021
cab4e85
Sync "Check Website" workflow's trigger order with the template
per1234 Aug 4, 2021
8301006
Add manual events as "Check Website" workflow triggers
per1234 Aug 4, 2021
d35d30b
Order "Check Website" workflow's steps according to the template
per1234 Aug 4, 2021
10d2e59
Remove pip update command from "Check Website" workflow
per1234 Aug 4, 2021
dc1dd59
Remove superfluous comment from "Check Website" workflow
per1234 Aug 4, 2021
82cfc78
Add "Check Website" workflow badge to readme
per1234 Aug 4, 2021
7713212
Add source URL comments to website assets
per1234 Aug 4, 2021
8a06ac3
Use workflow variables for tool versions in "Check Website" workflow
per1234 Aug 4, 2021
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
63 changes: 63 additions & 0 deletions .github/workflows/check-mkdocs-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-mkdocs-task.md
name: Check Website

env:
# See: https://github.com/actions/setup-go/tree/v2#readme
GO_VERSION: "1.14"
# See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python
PYTHON_VERSION: "3.9"

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-mkdocs-task.ya?ml"
- "Taskfile.ya?ml"
- "mkdocs.ya?ml"
- "poetry.lock"
- "pyproject.toml"
- "docs/**"
- "docsgen/**"
- "**.go"
pull_request:
paths:
- ".github/workflows/check-mkdocs-task.ya?ml"
- "Taskfile.ya?ml"
- "mkdocs.ya?ml"
- "poetry.lock"
- "pyproject.toml"
- "docs/**"
- "docsgen/**"
- "**.go"
workflow_dispatch:
repository_dispatch:

jobs:
check:
runs-on: ubuntu-latest

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

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
run: pip install poetry

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Build website
run: task website:check
2 changes: 1 addition & 1 deletion .github/workflows/check-python-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Check Python

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

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
name: Publish documentation
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md
name: Deploy Website

on:
push:
branches:
# Branch to base "dev" website on. Set in siteversion.py also.
- main
# Release branches have names like 0.8.x, 0.9.x, ...
- "[0-9]+.[0-9]+.x"
paths:
- "docs/**"
- ".github/workflows/deploy-cobra-mkdocs-versioned-poetry.ya?ml"
- "go.mod"
- "go.sum"
- "Taskfile.ya?ml"
- "**.go"
- "docsgen/**"
- "cli/**"
- ".github/workflows/publish-docs.yml"
- "mkdocs.ya?ml"
- "poetry.lock"
- "pyproject.toml"
# Run on branch or tag creation (will be filtered by the publish-determination job).
create:

Expand Down Expand Up @@ -38,46 +46,45 @@ jobs:
if: needs.publish-determination.outputs.result == 'true'

steps:
- name: Checkout local repository
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Taskfile
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.14"

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('./pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
python-version: "3.9"

- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Create all generated documentation content
run: task docs:generate

- name: Install Python dependencies
run: poetry install --no-root

- name: Determine versioning parameters
id: determine-versioning
run: echo "::set-output name=data::$(poetry run python docs/siteversion/siteversion.py)"

- name: Publish documentation
# Determine docs version for the commit pushed and publish accordingly using Mike.
# Publishing implies creating a git commit on the gh-pages branch, we let @ArduinoBot own these commits.
if: fromJson(steps.determine-versioning.outputs.data).version != null
run: |
# Publishing implies creating a git commit on the gh-pages branch, we let @ArduinoBot own these commits.
git config --global user.email "bot@arduino.cc"
git config --global user.name "ArduinoBot"
git fetch --no-tags --prune --depth=1 origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages
poetry run python docs/build.py
poetry run mike deploy \
--update-aliases \
--push \
--remote origin \
${{ fromJson(steps.determine-versioning.outputs.data).version }} \
${{ fromJson(steps.determine-versioning.outputs.data).alias }}
2 changes: 1 addition & 1 deletion .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.9"

- name: Install Poetry
run: pip install poetry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.9"

- name: Install Poetry
run: pip install poetry
Expand Down
61 changes: 0 additions & 61 deletions .github/workflows/validate-docs.yml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[![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)
[![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)
[![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)
[![Docs Status](https://github.com/arduino/arduino-lint/workflows/Publish%20documentation/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Publish+documentation)
[![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)
[![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)
[![Codecov](https://codecov.io/gh/arduino/arduino-lint/branch/main/graph/badge.svg?token=nprqPQMbdh)](https://codecov.io/gh/arduino/arduino-lint)
[![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)
[![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)
Expand Down
46 changes: 23 additions & 23 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,40 +226,40 @@ tasks:
cmds:
- poetry run black .

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

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

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

docs:publish:
desc: Use Mike to build and push versioned docs
cmds:
- task: docs:gen
- poetry run mike deploy --update-aliases --push --remote {{.DOCS_REMOTE}} {{.DOCS_VERSION}} {{.DOCS_ALIAS}}

docs:serve:
desc: Run documentation website locally
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
website:serve:
desc: Run website locally
deps:
- task: docs:generate
- task: poetry:install-deps
cmds:
- task: docs:build
- poetry run mkdocs serve

docs:check:
Expand Down
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ To build Arduino Lint from sources you need the following tools to be available

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

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

### Building the source code
Expand Down Expand Up @@ -232,7 +232,7 @@ documentation website. You can build the documentation website and serve it from
command:

```
task docs:serve
task website:serve
```

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

```shell
task docs:check
task website:check
```

If the output tells you that some files are not formatted correctly run:
Expand Down
Loading