2020-02-07 22:20:40 +01:00
|
|
|
# Copyright (c) 2020 Linaro Limited.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2021-07-28 13:08:18 +02:00
|
|
|
name: Documentation Build
|
2020-02-07 22:20:40 +01:00
|
|
|
|
2020-10-16 19:47:21 +02:00
|
|
|
on:
|
2021-07-27 19:11:11 +02:00
|
|
|
schedule:
|
2022-03-26 11:19:50 +01:00
|
|
|
- cron: '0 */3 * * *'
|
2021-07-27 19:11:11 +02:00
|
|
|
push:
|
|
|
|
tags:
|
2022-03-26 11:19:50 +01:00
|
|
|
- v*
|
2020-10-16 19:47:21 +02:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'doc/**'
|
|
|
|
- '**.rst'
|
|
|
|
- 'include/**'
|
|
|
|
- 'kernel/include/kernel_arch_interface.h'
|
|
|
|
- 'lib/libc/**'
|
|
|
|
- 'subsys/testsuite/ztest/include/**'
|
|
|
|
- 'tests/**'
|
2020-11-07 13:49:45 +01:00
|
|
|
- '**/Kconfig*'
|
2020-12-10 20:31:59 +01:00
|
|
|
- 'west.yml'
|
2020-12-10 20:36:58 +01:00
|
|
|
- '.github/workflows/doc-build.yml'
|
2021-03-30 20:02:38 +02:00
|
|
|
- 'scripts/dts/**'
|
2023-06-29 11:11:34 +02:00
|
|
|
- 'doc/requirements.txt'
|
2020-02-07 22:20:40 +01:00
|
|
|
|
2021-07-28 10:22:04 +02:00
|
|
|
env:
|
|
|
|
# NOTE: west docstrings will be extracted from the version listed here
|
2023-10-07 02:14:28 +02:00
|
|
|
WEST_VERSION: 1.2.0
|
2021-08-12 11:30:39 +02:00
|
|
|
# The latest CMake available directly with apt is 3.18, but we need >=3.20
|
|
|
|
# so we fetch that through pip.
|
|
|
|
CMAKE_VERSION: 3.20.5
|
2023-01-10 09:16:08 +01:00
|
|
|
DOXYGEN_VERSION: 1.9.6
|
2021-07-28 10:22:04 +02:00
|
|
|
|
2020-02-07 22:20:40 +01:00
|
|
|
jobs:
|
2021-07-20 18:43:12 +02:00
|
|
|
doc-build-html:
|
|
|
|
name: "Documentation Build (HTML)"
|
2023-10-20 17:59:05 +02:00
|
|
|
if: github.repository_owner == 'zephyrproject-rtos'
|
2023-06-29 10:55:23 +02:00
|
|
|
runs-on: zephyr-runner-linux-x64-4xlarge
|
2022-07-19 17:38:12 +02:00
|
|
|
timeout-minutes: 45
|
2021-12-10 16:23:14 +01:00
|
|
|
concurrency:
|
|
|
|
group: doc-build-html-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2020-02-07 22:20:40 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
2022-10-13 19:48:20 +02:00
|
|
|
uses: actions/checkout@v3
|
2023-09-22 23:02:47 +02:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Rebase
|
|
|
|
continue-on-error: true
|
|
|
|
env:
|
|
|
|
BASE_REF: ${{ github.base_ref }}
|
|
|
|
PR_HEAD: ${{ github.event.pull_request.head.sha }}
|
|
|
|
run: |
|
|
|
|
git config --global user.email "actions@zephyrproject.org"
|
|
|
|
git config --global user.name "Github Actions"
|
|
|
|
git rebase origin/${BASE_REF}
|
|
|
|
git log --graph --oneline HEAD...${PR_HEAD}
|
2020-02-07 22:20:40 +01:00
|
|
|
|
|
|
|
- name: install-pkgs
|
|
|
|
run: |
|
2022-01-07 13:00:19 +01:00
|
|
|
sudo apt-get update
|
2022-11-18 13:06:07 +01:00
|
|
|
sudo apt-get install -y ninja-build graphviz
|
2023-01-19 15:35:41 +01:00
|
|
|
wget --no-verbose "https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz"
|
2021-10-03 18:37:04 +02:00
|
|
|
tar xf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz
|
|
|
|
echo "${PWD}/doxygen-${DOXYGEN_VERSION}/bin" >> $GITHUB_PATH
|
2020-02-07 22:20:40 +01:00
|
|
|
|
|
|
|
- name: cache-pip
|
2022-10-13 20:11:23 +02:00
|
|
|
uses: actions/cache@v3
|
2020-02-07 22:20:40 +01:00
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
2023-06-29 11:11:34 +02:00
|
|
|
key: pip-${{ hashFiles('doc/requirements.txt') }}
|
2020-02-07 22:20:40 +01:00
|
|
|
|
|
|
|
- name: install-pip
|
|
|
|
run: |
|
2021-04-08 14:05:25 +02:00
|
|
|
sudo pip3 install -U setuptools wheel pip
|
2023-06-29 11:11:34 +02:00
|
|
|
pip3 install -r doc/requirements.txt
|
2021-07-28 10:22:04 +02:00
|
|
|
pip3 install west==${WEST_VERSION}
|
2021-08-12 11:30:39 +02:00
|
|
|
pip3 install cmake==${CMAKE_VERSION}
|
2020-02-07 22:20:40 +01:00
|
|
|
|
|
|
|
- name: west setup
|
|
|
|
run: |
|
2021-07-26 12:47:51 +02:00
|
|
|
west init -l .
|
2020-02-07 22:20:40 +01:00
|
|
|
|
|
|
|
- name: build-docs
|
2023-06-20 13:40:13 +02:00
|
|
|
shell: bash
|
2020-02-07 22:20:40 +01:00
|
|
|
run: |
|
2021-07-28 11:11:07 +02:00
|
|
|
if [[ "$GITHUB_REF" =~ "refs/tags/v" ]]; then
|
|
|
|
DOC_TAG="release"
|
|
|
|
else
|
|
|
|
DOC_TAG="development"
|
|
|
|
fi
|
|
|
|
|
2021-12-13 15:55:15 +01:00
|
|
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
|
|
|
DOC_TARGET="html-fast"
|
|
|
|
else
|
|
|
|
DOC_TARGET="html"
|
|
|
|
fi
|
|
|
|
|
2023-06-29 10:49:09 +02:00
|
|
|
DOC_TAG=${DOC_TAG} SPHINXOPTS_EXTRA="-q -t publish" make -C doc ${DOC_TARGET}
|
2021-07-26 12:43:50 +02:00
|
|
|
|
|
|
|
- name: compress-docs
|
|
|
|
run: |
|
|
|
|
tar cfJ html-output.tar.xz --directory=doc/_build html
|
2020-02-07 22:20:40 +01:00
|
|
|
|
|
|
|
- name: upload-build
|
2022-08-22 19:14:04 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-02-07 22:20:40 +01:00
|
|
|
with:
|
2021-07-26 12:43:50 +02:00
|
|
|
name: html-output
|
|
|
|
path: html-output.tar.xz
|
2021-07-20 18:43:12 +02:00
|
|
|
|
2022-03-26 11:19:50 +01:00
|
|
|
- name: process-pr
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
run: |
|
|
|
|
REPO_NAME="${{ github.event.repository.name }}"
|
|
|
|
PR_NUM="${{ github.event.pull_request.number }}"
|
|
|
|
DOC_URL="https://builds.zephyrproject.io/${REPO_NAME}/pr/${PR_NUM}/docs/"
|
|
|
|
|
|
|
|
echo "${PR_NUM}" > pr_num
|
2022-05-17 15:47:31 +02:00
|
|
|
echo "Documentation will be available shortly at: ${DOC_URL}" >> $GITHUB_STEP_SUMMARY
|
2022-03-26 11:19:50 +01:00
|
|
|
|
|
|
|
- name: upload-pr-number
|
2022-10-13 19:57:47 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-03-26 11:19:50 +01:00
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
with:
|
|
|
|
name: pr_num
|
|
|
|
path: pr_num
|
|
|
|
|
2021-07-20 18:43:12 +02:00
|
|
|
doc-build-pdf:
|
|
|
|
name: "Documentation Build (PDF)"
|
2023-10-20 17:59:05 +02:00
|
|
|
if: |
|
|
|
|
github.event_name != 'pull_request' &&
|
|
|
|
github.repository_owner == 'zephyrproject-rtos'
|
2023-06-20 14:46:04 +02:00
|
|
|
runs-on: zephyr-runner-linux-x64-4xlarge
|
2021-07-20 18:43:12 +02:00
|
|
|
container: texlive/texlive:latest
|
2022-12-13 11:31:42 +01:00
|
|
|
timeout-minutes: 60
|
2021-12-10 16:23:14 +01:00
|
|
|
concurrency:
|
|
|
|
group: doc-build-pdf-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2021-07-20 18:43:12 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
2022-10-13 19:48:20 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-07-20 18:43:12 +02:00
|
|
|
|
|
|
|
- name: install-pkgs
|
|
|
|
run: |
|
|
|
|
apt-get update
|
2023-02-23 17:14:17 +01:00
|
|
|
apt-get install -y python3-pip python3-venv ninja-build doxygen graphviz librsvg2-bin
|
2021-07-20 18:43:12 +02:00
|
|
|
|
|
|
|
- name: cache-pip
|
2022-10-13 20:11:23 +02:00
|
|
|
uses: actions/cache@v3
|
2021-07-20 18:43:12 +02:00
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
2023-06-29 11:11:34 +02:00
|
|
|
key: pip-${{ hashFiles('doc/requirements.txt') }}
|
2021-07-20 18:43:12 +02:00
|
|
|
|
2023-02-23 17:14:17 +01:00
|
|
|
- name: setup-venv
|
|
|
|
run: |
|
|
|
|
python3 -m venv .venv
|
|
|
|
. .venv/bin/activate
|
|
|
|
echo PATH=$PATH >> $GITHUB_ENV
|
|
|
|
|
2021-07-20 18:43:12 +02:00
|
|
|
- name: install-pip
|
|
|
|
run: |
|
|
|
|
pip3 install -U setuptools wheel pip
|
2023-06-29 11:11:34 +02:00
|
|
|
pip3 install -r doc/requirements.txt
|
2021-07-28 10:22:04 +02:00
|
|
|
pip3 install west==${WEST_VERSION}
|
2021-08-12 11:30:39 +02:00
|
|
|
pip3 install cmake==${CMAKE_VERSION}
|
2021-07-20 18:43:12 +02:00
|
|
|
|
|
|
|
- name: west setup
|
|
|
|
run: |
|
|
|
|
west init -l .
|
|
|
|
|
|
|
|
- name: build-docs
|
2023-06-20 13:40:13 +02:00
|
|
|
shell: bash
|
2023-06-20 13:04:13 +02:00
|
|
|
continue-on-error: true
|
2021-07-20 18:43:12 +02:00
|
|
|
run: |
|
2021-07-28 11:11:07 +02:00
|
|
|
if [[ "$GITHUB_REF" =~ "refs/tags/v" ]]; then
|
|
|
|
DOC_TAG="release"
|
|
|
|
else
|
|
|
|
DOC_TAG="development"
|
|
|
|
fi
|
|
|
|
|
|
|
|
DOC_TAG=${DOC_TAG} SPHINXOPTS="-q -j auto" LATEXMKOPTS="-quiet -halt-on-error" make -C doc pdf
|
2021-07-20 18:43:12 +02:00
|
|
|
|
|
|
|
- name: upload-build
|
2023-06-20 13:04:13 +02:00
|
|
|
if: always()
|
2022-08-22 19:14:04 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-07-20 18:43:12 +02:00
|
|
|
with:
|
|
|
|
name: pdf-output
|
2023-06-20 13:04:13 +02:00
|
|
|
if-no-files-found: ignore
|
|
|
|
path: |
|
|
|
|
doc/_build/latex/zephyr.pdf
|
|
|
|
doc/_build/latex/zephyr.log
|