diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml deleted file mode 100644 index 2f2222782..000000000 --- a/.github/workflows/build-documentation.yml +++ /dev/null @@ -1,191 +0,0 @@ ---- -# SPDX-FileCopyrightText: (C) 2025 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -name: "Build Documentation" - -on: # yamllint disable-line rule:truthy rule:line-length - workflow_call: - inputs: - docs_directory: - description: >- - Documentation directory where the job will run, defaults to '.' - required: false - default: "." - type: string - output_directory: - description: >- - Directory where the documentation HTML build is located, - defaults to 'out/html' - required: false - default: "out/html" - type: string - branch_pattern: - description: >- - Regex pattern to match against when selecting branches to build for - version selector, defaults to '^(main|release-.*)$' - required: false - default: "^(main|release-.*)$" - type: string - simple_mode: - description: >- - When true, override configuration for simple documentation sites - required: false - default: true - type: boolean - orch_ci_repo_ref: - description: >- - The ref of the orch-ci repo, including bootstrap action and scripts, - defaults to 'main' - required: false - default: "main" - type: string - endpoint: - description: >- - Endpoint URL where documentation will be deployed to, - defaults to 's3://intel-openedgeplatform-documentation' - required: false - default: "s3://intel-openedgeplatform-documentation" - type: string - distribution_id: - description: >- - Distribution ID of documentation hosting service, - defaults to 'E1QN7TZJG8M0VL' - required: false - default: "E1QN7TZJG8M0VL" - type: string - exclude_patterns: - description: >- - Comma separated list of exclude patterns to use during the build, - defaults to empty list - required: false - default: "" - type: string - secrets: - SYS_EMF_GH_TOKEN: - description: "PAT (contents: read) to clone private repos" - required: true - DOC_AWS_ACCESS_KEY_ID: - description: AWS access key for docs bucket - required: true - DOC_AWS_SECRET_ACCESS_KEY: - description: AWS secret access key for docs bucket - required: true -permissions: - contents: read -jobs: - build-documentation: - permissions: - contents: read # minimal privilege required - runs-on: ubuntu-latest - env: - DOCS_DIR: ${{ inputs.docs_directory }} - steps: - - name: Checkout action repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - repository: open-edge-platform/orch-ci - path: ci - ref: ${{ inputs.orch_ci_repo_ref }} - persist-credentials: false - - - name: Bootstrap CI environment - uses: ./ci/.github/actions/bootstrap - with: - gh_token: ${{ secrets.SYS_EMF_GH_TOKEN }} - bootstrap_tools: "aws" - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1 - with: - aws-access-key-id: ${{ secrets.DOC_AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.DOC_AWS_SECRET_ACCESS_KEY }} - aws-region: us-west-2 - - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - # Fetch all history, otherwise sporadic issue with missing tags - fetch-depth: 0 - # Fetch tags - fetch-tags: true - # Checkout the branch that triggered the workflow - # to avoid detached HEAD - ref: ${{ github.head_ref }} - persist-credentials: false - - # Fetch template from AWS S3 bucket - - name: Checkout template - if: ${{ inputs.simple_mode }} - env: - ENDPOINT: ${{ inputs.endpoint }} - shell: bash - run: | - mkdir -p "${GITHUB_WORKSPACE}"/_template - aws s3 cp --recursive "${ENDPOINT}/template" \ - "${GITHUB_WORKSPACE}"/_template - - - name: Copy template - if: ${{ inputs.simple_mode }} - shell: bash - run: | - cd "${GITHUB_WORKSPACE}/${DOCS_DIR}" - # Override any existing files with template - cp -rf "${GITHUB_WORKSPACE}"/_template/* . - if [ -f "dictionary_append.txt" ]; then - cat "dictionary_append.txt" >> "dict.txt" - fi - - - name: Add exclude patterns - env: - EXCLUDE: ${{ inputs.exclude_patterns }} - shell: bash - run: | - # Remove any spaces - exclude_no_spaces="${EXCLUDE// /}" - # Surround patterns with quotes and create Python list - exclude_pattern="[\"${exclude_no_spaces//,/\", \"}\"]" - conf_files=$(find "${GITHUB_WORKSPACE}" -type f -path "*/docs/conf.py") - for conf_file in $conf_files; do - echo "exclude_patterns.extend(${exclude_pattern})" >> "$conf_file" - done - - - name: Install Spark theme - if: false # Disable step - Spark theme deprecated - env: - ENDPOINT: ${{ inputs.endpoint }} - shell: bash - run: | - # Download Spark Sphinx theme - tmpdir="$(mktemp -d)" - aws s3 cp "${ENDPOINT}/theme/current" "${tmpdir}" - theme_wheel="$(cat "${tmpdir}/current")" - aws s3 cp "${ENDPOINT}/theme/${theme_wheel}" "${tmpdir}" - # Instantiate Python Virtual Environment - cd "${GITHUB_WORKSPACE}/${DOCS_DIR}" - make check - venv="$(find . -path '*/bin/activate' -name activate)" - # shellcheck source=/dev/null - source "${venv}" - # Install Spark Sphinx theme - pip3 install --no-input "${tmpdir}/${theme_wheel}" - deactivate - - - name: Build Documentation - env: - SIMPLE_MODE: ${{ inputs.simple_mode }} - shell: bash - run: | - cd "${GITHUB_WORKSPACE}/${DOCS_DIR}" - make build - - # Checkout orch-ci again so the - # 'Post Bootstrap CI Environment' step does not fail - - name: Checkout action repository - if: always() - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - repository: open-edge-platform/orch-ci - path: ci - ref: ${{ inputs.orch_ci_repo_ref }} - persist-credentials: false diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml deleted file mode 100644 index 9546ce992..000000000 --- a/.github/workflows/docs-build.yml +++ /dev/null @@ -1,100 +0,0 @@ ---- -# SPDX-FileCopyrightText: (C) 2025 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -name: "[CI/CD] Build Docs" -run-name: "[CI/CD] Build Docs" - -on: # yamllint disable-line rule:truthy - pull_request: - branches: - - main - - release-* - workflow_dispatch: {} - -permissions: - contents: read # needed for actions/checkout - -jobs: - filter: - name: "Filter Changed Documentation Paths" - runs-on: ubuntu-latest - outputs: - toplevel_changed: ${{ steps.filter.outputs.toplevel }} - autocalibration_changed: ${{ steps.filter.outputs.autocalibration }} - controller_changed: ${{ steps.filter.outputs.controller }} - cluster_analytics_changed: ${{ steps.filter.outputs.cluster_analytics }} - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Set paths filter - id: filter - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - with: - filters: | - toplevel: - - 'docs/**' - autocalibration: - - 'autocalibration/docs/**' - controller: - - 'controller/docs/**' - cluster_analytics: - - 'cluster_analytics/docs/**' - - build_toplevel: - name: "Build Toplevel Documentation" - needs: filter - if: ${{ needs.filter.outputs.toplevel_changed == 'true' }} - uses: ./.github/workflows/build-documentation.yml - secrets: - SYS_EMF_GH_TOKEN: ${{ secrets.SYS_EMF_GH_TOKEN }} - DOC_AWS_ACCESS_KEY_ID: ${{ secrets.DOC_AWS_ACCESS_KEY_ID }} - DOC_AWS_SECRET_ACCESS_KEY: ${{ secrets.DOC_AWS_SECRET_ACCESS_KEY }} - with: - exclude_patterns: "README.md, adr, design, development" - - build_autocalibration: - name: "Build AutoCalibration Documentation" - needs: filter - if: ${{ needs.filter.outputs.autocalibration_changed == 'true' }} - uses: ./.github/workflows/build-documentation.yml - secrets: - SYS_EMF_GH_TOKEN: ${{ secrets.SYS_EMF_GH_TOKEN }} - DOC_AWS_ACCESS_KEY_ID: ${{ secrets.DOC_AWS_ACCESS_KEY_ID }} - DOC_AWS_SECRET_ACCESS_KEY: ${{ secrets.DOC_AWS_SECRET_ACCESS_KEY }} - with: - docs_directory: autocalibration - - build_controller: - name: "Build Controller Documentation" - needs: filter - if: ${{ needs.filter.outputs.controller_changed == 'true' }} - uses: ./.github/workflows/build-documentation.yml - secrets: - SYS_EMF_GH_TOKEN: ${{ secrets.SYS_EMF_GH_TOKEN }} - DOC_AWS_ACCESS_KEY_ID: ${{ secrets.DOC_AWS_ACCESS_KEY_ID }} - DOC_AWS_SECRET_ACCESS_KEY: ${{ secrets.DOC_AWS_SECRET_ACCESS_KEY }} - with: - docs_directory: controller - - build_status: - name: "Documentation Build Status" - runs-on: ubuntu-latest - if: always() - needs: - - filter - - build_toplevel - - build_autocalibration - - build_controller - steps: - - name: "Set documentation build status" - run: | - if [[ "${{ needs.filter.result }}" != "success" && "${{ needs.filter.result }}" != "skipped" ]] || \ - [[ "${{ needs.build_toplevel.result }}" != "success" && "${{ needs.build_toplevel.result }}" != "skipped" ]] || \ - [[ "${{ needs.build_autocalibration.result }}" != "success" && "${{ needs.build_autocalibration.result }}" != "skipped" ]] || \ - [[ "${{ needs.build_controller.result }}" != "success" && "${{ needs.build_controller.result }}" != "skipped" ]]; then - echo "One or more jobs failed" - exit 1 - else - echo "All jobs succeeded or were skipped" - exit 0 - fi diff --git a/.github/workflows/docs-reusable-workflow.yaml b/.github/workflows/docs-reusable-workflow.yaml new file mode 100644 index 000000000..a3e1ea0c2 --- /dev/null +++ b/.github/workflows/docs-reusable-workflow.yaml @@ -0,0 +1,85 @@ +--- +# SPDX-FileCopyrightText: (C) 2025 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: "Build Documentation" + +on: # yamllint disable-line rule:truthy rule:line-length + workflow_call: + inputs: + docs_directory: + description: >- + Documentation directory where the job will run, defaults to '.' + required: false + default: "." + type: string + simple_mode: + description: >- + When true, override configuration for simple documentation sites + required: false + default: true + type: boolean + exclude_patterns: + description: >- + Comma separated list of exclude patterns to use during the build, + defaults to empty list + required: false + default: "" + type: string + +permissions: + contents: read + +jobs: + build-documentation: + permissions: + contents: read # minimal privilege required + runs-on: ubuntu-latest + env: + DOCS_DIR: ${{ inputs.docs_directory }} + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + # Fetch all history, otherwise sporadic issue with missing tags + fetch-depth: 0 + # Fetch tags + fetch-tags: true + # Checkout the branch that triggered the workflow + # to avoid detached HEAD + ref: ${{ github.event.pull_request.head.sha || github.head_ref }} + persist-credentials: false + + - name: Download template + if: ${{ inputs.simple_mode }} + shell: bash + run: | + cd "${GITHUB_WORKSPACE}/${DOCS_DIR}" + wget https://docs.openedgeplatform.intel.com/template/template.tar.gz + # Override any existing files with template + tar xf template.tar.gz + if [ -f "dictionary_append.txt" ]; then + cat "dictionary_append.txt" >> "dict.txt" + fi + + - name: Add exclude patterns + env: + EXCLUDE: ${{ inputs.exclude_patterns }} + shell: bash + run: | + # Remove any spaces + exclude_no_spaces="${EXCLUDE// /}" + # Surround patterns with quotes and create Python list + exclude_pattern="[\"${exclude_no_spaces//,/\", \"}\"]" + conf_files=$(find "${GITHUB_WORKSPACE}" -type f -path "*/docs/conf.py") + for conf_file in $conf_files; do + echo "exclude_patterns.extend(${exclude_pattern})" >> "$conf_file" + done + + - name: Build Documentation + env: + SIMPLE_MODE: ${{ inputs.simple_mode }} + shell: bash + run: | + cd "${GITHUB_WORKSPACE}/${DOCS_DIR}" + make build diff --git a/.github/workflows/documentation-check.yaml b/.github/workflows/documentation-check.yaml new file mode 100644 index 000000000..7dd129449 --- /dev/null +++ b/.github/workflows/documentation-check.yaml @@ -0,0 +1,42 @@ +--- +# SPDX-FileCopyrightText: (C) 2025 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Documentation Check + +on: # yamllint disable-line rule:truthy + pull_request: + branches: + - main + - release-* + workflow_dispatch: + +permissions: {} + +jobs: + filter: + permissions: + contents: read # needed for actions/checkout + runs-on: ubuntu-latest + outputs: + scenescape_documentation_changed: ${{ steps.filter.outputs.scenescape_documentation }} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Set paths filter + id: filter + uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 + with: + filters: | + scenescape_documentation: + - 'docs/user-guide/**' + + build-scenescape-documentation: + permissions: + contents: read # needed for actions/checkout + needs: filter + if: ${{ needs.filter.outputs.scenescape_documentation_changed == 'true' }} + uses: ./.github/workflows/docs-reusable-workflow.yaml + with: + docs_directory: .