diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml new file mode 100644 index 0000000000..73690662f3 --- /dev/null +++ b/.github/workflows/docs-build.yml @@ -0,0 +1,43 @@ +name: Build Sphinx documentation + +on: + # Run this workflow when documentation sources or this workflow definition change. + push: + branches: [main] + paths: + - "docs/**" + - "cosmos/**" + - ".github/workflows/docs-build.yml" + pull_request: + branches: [main] + paths: + - "docs/**" + - "cosmos/**" + - ".github/workflows/docs-build.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + persist-credentials: false + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: "3.11" + + - name: Install documentation dependencies + run: | + python -m pip install --upgrade pip + pip install -r docs/requirements.txt + + - name: Build Sphinx documentation + run: sphinx-build -b html docs docs/_build --fail-on-warning --fresh-env diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd8c6c5556..5b52a1f677 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -85,6 +85,7 @@ jobs: .github/ISSUE_TEMPLATE/*) ;; .github/dependabot.yml) ;; .github/workflows/docs.yml) ;; + .github/workflows/docs-build.yml) ;; .github/workflows/stale.yml) ;; .github/workflows/actionlint.yml) ;; .github/workflows/codeql.yml) ;; diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3f5a23ae70..7fe603a0f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -100,27 +100,6 @@ repos: - id: blacken-docs alias: black additional_dependencies: [black>=26.3.1] - - repo: local - hooks: - - id: check-docs-build - name: Ensure the docs build without errors - entry: sphinx-build -b html docs docs/_build --fail-on-warning --fresh-env - language: python - additional_dependencies: - [ - "aenum", - "deprecation", - "msgpack", - "apache-airflow", - "pydata-sphinx-theme>=0.16.0", - "sphinx", - "sphinx-autoapi", - "sphinx-autobuild", - "sphinx-reredirects", - "sphinxcontrib.mermaid", - ] - pass_filenames: false - files: ^docs/ - repo: https://github.com/pre-commit/mirrors-mypy rev: "v1.20.0" hooks: