ci: build docs on pr (#8089)

This commit is contained in:
André Costa
2025-04-15 09:19:21 +02:00
committed by GitHub
parent 19cb83732b
commit 3a5e03b37f
4 changed files with 30 additions and 8 deletions
+11 -2
View File
@@ -1,5 +1,6 @@
name: Build docs name: Build docs
on: on:
pull_request:
push: push:
branches: branches:
- master - master
@@ -62,7 +63,14 @@ jobs:
- name: ccache - name: ccache
uses: hendrikmuhs/ccache-action@v1 uses: hendrikmuhs/ccache-action@v1
- name: Build examples (with cache) - name: Build examples (with cache)
run: scripts/build_html_examples.sh run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
REPO_URL="${{ github.event.pull_request.head.repo.clone_url }}"
COMMIT_REF="${{ github.event.pull_request.head.sha }}"
./scripts/build_html_examples.sh "$REPO_URL" "$COMMIT_REF"
else
./scripts/build_html_examples.sh
fi
- name: Build docs - name: Build docs
run: docs/build.py html run: docs/build.py html
- name: Remove .doctrees - name: Remove .doctrees
@@ -72,6 +80,7 @@ jobs:
echo "::set-output name=VERSION_NAME::$(scripts/find_version.sh)" echo "::set-output name=VERSION_NAME::$(scripts/find_version.sh)"
id: version id: version
- name: Deploy to subfolder - name: Deploy to subfolder
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: JamesIves/github-pages-deploy-action@v4.7.3 uses: JamesIves/github-pages-deploy-action@v4.7.3
with: with:
token: ${{ secrets.LVGL_BOT_TOKEN }} token: ${{ secrets.LVGL_BOT_TOKEN }}
@@ -83,7 +92,7 @@ jobs:
git-config-email: lvgl-bot@users.noreply.github.com git-config-email: lvgl-bot@users.noreply.github.com
single-commit: true single-commit: true
- name: Deploy to master - name: Deploy to master
if: github.ref == 'refs/heads/master' if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: JamesIves/github-pages-deploy-action@v4.7.3 uses: JamesIves/github-pages-deploy-action@v4.7.3
with: with:
token: ${{ secrets.LVGL_BOT_TOKEN }} token: ${{ secrets.LVGL_BOT_TOKEN }}
+1 -1
View File
@@ -243,7 +243,7 @@ def cmd(cmd_str, start_dir=None, exit_on_error=True):
if return_code != 0 and exit_on_error: if return_code != 0 and exit_on_error:
announce(__file__, "Exiting build due to previous error.") announce(__file__, "Exiting build due to previous error.")
sys.exit(return_code) sys.exit(1)
def intermediate_dir_contents_exists(dir): def intermediate_dir_contents_exists(dir):
-3
View File
@@ -16,10 +16,7 @@
# documentation root, use os.path.abspath() to make it absolute, as shown here. # documentation root, use os.path.abspath() to make it absolute, as shown here.
import os import os
import sys import sys
import re
from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.builders.html import StandaloneHTMLBuilder
from sphinxawesome_theme.postprocess import Icons
aaa = Icons.permalinks_icon
base_path = os.path.abspath(os.path.dirname(__file__)) base_path = os.path.abspath(os.path.dirname(__file__))
# Add path to import link_roles.py and lv_example.py # Add path to import link_roles.py and lv_example.py
+18 -2
View File
@@ -1,14 +1,30 @@
#!/bin/bash #!/bin/bash
set -e set -e
# These variables allow us to specify an alternate repository URL and commit reference
# This is particularly useful when running in CI environments for pull requests
# where we need to build from the contributor's forked repository
REPO_URL="${1:-}"
COMMIT_REF="${2:-}"
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
CURRENT_REF="$(git rev-parse HEAD)"
rm -rf emscripten_builder rm -rf emscripten_builder
git clone https://github.com/lvgl/lv_sim_emscripten.git emscripten_builder git clone https://github.com/lvgl/lv_sim_emscripten.git emscripten_builder
scripts/genexamplelist.sh > emscripten_builder/examplelist.c scripts/genexamplelist.sh > emscripten_builder/examplelist.c
cd emscripten_builder cd emscripten_builder
git submodule update --init -- lvgl git submodule update --init -- lvgl
cd lvgl cd lvgl
git checkout $CURRENT_REF if [ -n "$REPO_URL" ] && [ -n "$COMMIT_REF" ]; then
echo "Using provided repo URL: $REPO_URL and commit ref: $COMMIT_REF for lvgl submodule"
git remote set-url origin "$REPO_URL"
git fetch origin
git checkout "$COMMIT_REF"
else
CURRENT_REF="$(git rev-parse HEAD)"
echo "Using current commit ref: $CURRENT_REF for lvgl"
git checkout "$CURRENT_REF"
fi
cd .. cd ..
mkdir cmbuild mkdir cmbuild
cd cmbuild cd cmbuild