Skip to content

Commit 5ad6358

Browse files
committed
ci: workflows: doc: use self-hosted runner
Running full documentation build on GH hosted runners is not really working for us anymore as we run out of disk space. Switch (back) to our self-hosted runners. Signed-off-by: Benjamin Cabé <[email protected]>
1 parent ab14979 commit 5ad6358

File tree

1 file changed

+65
-52
lines changed

1 file changed

+65
-52
lines changed

.github/workflows/doc-build.yml

Lines changed: 65 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717
env:
1818
DOXYGEN_VERSION: 1.14.0
1919
DOXYGEN_MD5SUM: e761a5097ae20ecccfd02041925f102a
20-
JOB_COUNT: 4
20+
JOB_COUNT: 30
2121

2222
jobs:
2323
doc-file-check:
@@ -56,49 +56,68 @@ jobs:
5656
needs: [doc-file-check]
5757
if: >
5858
needs.doc-file-check.outputs.file_check == 'true' || github.event_name != 'pull_request'
59-
runs-on: ubuntu-24.04
60-
timeout-minutes: 90
59+
runs-on:
60+
group: zephyr-runner-v2-linux-x64-4xlarge
61+
container:
62+
image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.28.5.20250930
63+
options: '--entrypoint /bin/bash'
64+
timeout-minutes: 20
6165
concurrency:
6266
group: doc-build-html-${{ github.ref }}
6367
cancel-in-progress: true
68+
env:
69+
BASE_REF: ${{ github.base_ref }}
70+
6471

6572
steps:
66-
- name: install-pkgs
73+
74+
- name: Print cloud service information
6775
run: |
68-
sudo apt-get update
69-
sudo apt-get install -y wget python3-pip git ninja-build graphviz lcov
70-
wget --no-verbose "https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz"
71-
echo "${DOXYGEN_MD5SUM} doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz" | md5sum -c
72-
if [ $? -ne 0 ]; then
73-
echo "Failed to verify doxygen tarball"
74-
exit 1
75-
fi
76-
sudo tar xf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz -C /opt
77-
echo "/opt/doxygen-${DOXYGEN_VERSION}/bin" >> $GITHUB_PATH
78-
echo "${HOME}/.local/bin" >> $GITHUB_PATH
76+
echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}"
77+
echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}"
78+
echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}"
79+
80+
- name: Apply container owner mismatch workaround
81+
run: |
82+
# FIXME: The owner UID of the GITHUB_WORKSPACE directory may not
83+
# match the container user UID because of the way GitHub
84+
# Actions runner is implemented. Remove this workaround when
85+
# GitHub comes up with a fundamental fix for this problem.
86+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
87+
88+
- name: Clone cached Zephyr repository
89+
continue-on-error: true
90+
run: |
91+
git clone --shared /repo-cache/zephyrproject/zephyr .
92+
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
7993
8094
- name: checkout
8195
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
8296
with:
8397
ref: ${{ github.event.pull_request.head.sha }}
8498
fetch-depth: 0
85-
path: zephyr
8699

87-
- name: Rebase
88-
if: github.event_name == 'pull_request'
89-
continue-on-error: true
90-
env:
91-
BASE_REF: ${{ github.base_ref }}
92-
PR_HEAD: ${{ github.event.pull_request.head.sha }}
93-
working-directory: zephyr
100+
- name: Environment Setup
94101
run: |
95-
git config --global user.email "[email protected]"
96-
git config --global user.name "Github Actions"
97-
rm -fr ".git/rebase-apply"
98-
rm -fr ".git/rebase-merge"
99-
git rebase origin/${BASE_REF}
100-
git clean -f -d
101-
git log --graph --oneline HEAD...${PR_HEAD}
102+
if [ "${{github.event_name}}" = "pull_request" ]; then
103+
git config --global user.email "[email protected]"
104+
git config --global user.name "Zephyr Builder"
105+
rm -fr ".git/rebase-apply"
106+
rm -fr ".git/rebase-merge"
107+
git rebase origin/${BASE_REF}
108+
git clean -f -d
109+
git log --pretty=oneline | head -n 10
110+
fi
111+
echo "$HOME/.local/bin" >> $GITHUB_PATH
112+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
113+
114+
west init -l . || true
115+
west config manifest.group-filter -- +ci,+optional
116+
west config --global update.narrow true
117+
west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject)
118+
west forall -c 'git reset --hard HEAD'
119+
120+
echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV
102121
103122
- name: Set up Python
104123
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
@@ -107,32 +126,27 @@ jobs:
107126
cache: pip
108127
cache-dependency-path: doc/requirements.txt
109128

110-
- name: Setup Zephyr project
111-
uses: zephyrproject-rtos/action-zephyr-setup@c125c5ebeeadbd727fa740b407f862734af1e52a # v1.0.9
112-
with:
113-
app-path: zephyr
114-
toolchains: 'all'
115-
116-
- name: install-pip
117-
working-directory: zephyr
129+
- name: Install Python packages required for documentation build
118130
run: |
131+
pip install -r scripts/requirements-actions.txt --require-hashes
119132
pip install -r doc/requirements.txt --require-hashes
120133
121-
- name: build-docs
134+
- name: Build HTML documentation
122135
shell: bash
123-
working-directory: zephyr
124136
run: |
137+
pip list
138+
125139
if [[ "$GITHUB_REF" =~ "refs/tags/v" ]]; then
126140
DOC_TAG="release"
127141
else
128142
DOC_TAG="development"
129143
fi
130144
131-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
132-
DOC_TARGET="html-fast"
133-
else
145+
# if [[ "${{ github.event_name }}" == "pull_request" ]]; then
146+
# DOC_TARGET="html-fast"
147+
# else
134148
DOC_TARGET="html"
135-
fi
149+
# fi
136150
137151
DOC_TAG=${DOC_TAG} \
138152
SPHINXOPTS="-j ${JOB_COUNT} -W --keep-going -T" \
@@ -145,27 +159,26 @@ jobs:
145159
lcov --remove doc-coverage.info \*/deprecated > new.info
146160
genhtml --no-function-coverage --no-branch-coverage new.info -o coverage-report
147161
148-
- name: compress-docs
149-
working-directory: zephyr
162+
- name: Compress documentation build artifacts
150163
run: |
151164
tar --use-compress-program="xz -T0" -cf html-output.tar.xz --exclude html/_sources --exclude html/doxygen/xml --directory=doc/_build html
152165
tar --use-compress-program="xz -T0" -cf api-output.tar.xz --directory=doc/_build html/doxygen/html
153166
tar --use-compress-program="xz -T0" -cf api-coverage.tar.xz coverage-report
154167
155-
- name: upload-build
168+
- name: Upload HTML output
156169
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
157170
with:
158171
name: html-output
159-
path: zephyr/html-output.tar.xz
172+
path: html-output.tar.xz
160173

161-
- name: upload-api-coverage
174+
- name: Upload Doxygen coverage artifacts
162175
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
163176
with:
164177
name: api-coverage
165-
path: zephyr/api-coverage.tar.xz
178+
path: api-coverage.tar.xz
166179

167180

168-
- name: process-pr
181+
- name: Summarize PR documentation URLs
169182
if: github.event_name == 'pull_request'
170183
run: |
171184
REPO_NAME="${{ github.event.repository.name }}"
@@ -179,7 +192,7 @@ jobs:
179192
echo "API Documentation will be available shortly at: ${API_DOC_URL}" >> $GITHUB_STEP_SUMMARY
180193
echo "API Coverage Report will be available shortly at: ${API_COVERAGE_URL}" >> $GITHUB_STEP_SUMMARY
181194
182-
- name: upload-pr-number
195+
- name: Upload PR number
183196
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
184197
if: github.event_name == 'pull_request'
185198
with:

0 commit comments

Comments
 (0)