From e1cf7faeb991db1eb0d28d96b7d0c0977a9505cd Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 15 Aug 2021 01:42:36 -0700 Subject: [PATCH] Sync website validation assets with template We have assembled a collection of reusable project assets: https://github.com/arduino/tooling-project-assets These assets will be used in the repositories of all Arduino tooling projects. Some minor improvements and standardizations have been made in the upstream "template" assets for checking the website publishing system, and those are introduced to this repository here. Notable: - Add paths filter to prevent unnecessary workflow runs - Bump Python version used by the workflow from 3.8 to 3.9 Some task names have changed: - `docs:build` -> `website:check` - `docs:serve` -> `website:serve` --- .github/workflows/check-mkdocs-task.yml | 67 +++++++++++++++++++++++++ .github/workflows/validate-docs.yaml | 36 ------------- Taskfile.yml | 34 +++++++------ 3 files changed, 85 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/check-mkdocs-task.yml delete mode 100644 .github/workflows/validate-docs.yaml diff --git a/.github/workflows/check-mkdocs-task.yml b/.github/workflows/check-mkdocs-task.yml new file mode 100644 index 00000000..fb16252c --- /dev/null +++ b/.github/workflows/check-mkdocs-task.yml @@ -0,0 +1,67 @@ +# 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.16" + # 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" + - "go.mod" + - "go.sum" + - "mkdocs.ya?ml" + - "poetry.lock" + - "pyproject.toml" + - "docs/**" + - "docsgen/**" + - "**.go" + pull_request: + paths: + - ".github/workflows/check-mkdocs-task.ya?ml" + - "Taskfile.ya?ml" + - "go.mod" + - "go.sum" + - "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 diff --git a/.github/workflows/validate-docs.yaml b/.github/workflows/validate-docs.yaml deleted file mode 100644 index 505f7406..00000000 --- a/.github/workflows/validate-docs.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: validate-docs - -on: - pull_request: - push: - -jobs: - validate: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Taskfile - uses: arduino/setup-task@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - version: 3.x - - - name: Setup Go - uses: actions/setup-go@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: "3.8" - - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install poetry - - - name: Build docs website - # Ensure the docs build is sane, these docs won't be published - run: task docs:build diff --git a/Taskfile.yml b/Taskfile.yml index 1c4ff1e2..ddc1adcc 100755 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -10,14 +10,6 @@ tasks: cmds: - poetry install --no-root - docs:serve: - desc: Run website locally - deps: - - task: poetry:install-deps - - task: docs:generate - cmds: - - poetry run mkdocs serve - # 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 @@ -37,14 +29,6 @@ tasks: cmds: - npx {{ .PRETTIER }} --write "**/*.md" - docs:build: - desc: Build documentation website contents - deps: - - docs:generate - - poetry:install-deps - cmds: - - poetry run mkdocs build -s - # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml general:format-prettier: desc: Format all supported files with Prettier @@ -228,6 +212,24 @@ tasks: cmds: - poetry run black . + # 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: + - poetry run mkdocs build --strict + + # 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: + - poetry run mkdocs serve + vars: PROJECT_NAME: "arduino-fwuploader" DIST_DIR: "dist"