ci(docs): fix docs CI. use the action's checked-out repo for emscripten (#9020)

This commit is contained in:
Liam Howatt
2025-10-09 09:15:32 +02:00
committed by GitHub
parent 08a9eb60cf
commit 427d2b3ed8
2 changed files with 37 additions and 26 deletions
+9 -10
View File
@@ -23,6 +23,7 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
with: with:
path: lvgl
persist-credentials: false persist-credentials: false
fetch-depth: 0 fetch-depth: 0
- name: Setup Python - name: Setup Python
@@ -41,14 +42,14 @@ jobs:
!${{ env.pythonLocation }}/bin/pip* !${{ env.pythonLocation }}/bin/pip*
!${{ env.pythonLocation }}/lib/python*/site-packages/pip* !${{ env.pythonLocation }}/lib/python*/site-packages/pip*
!${{ env.pythonLocation }}/lib/python*/site-packages/setuptools* !${{ env.pythonLocation }}/lib/python*/site-packages/setuptools*
key: ${{ env.pythonLocation }}-${{ hashFiles('docs/requirements.txt') }} key: ${{ env.pythonLocation }}-${{ hashFiles('lvgl/docs/requirements.txt') }}
- name: Install Doxygen and Latex dependencies - name: Install Doxygen and Latex dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install doxygen texlive-xetex texlive-binaries texlive-lang-english latexmk fonts-freefont-otf sudo apt-get install doxygen texlive-xetex texlive-binaries texlive-lang-english latexmk fonts-freefont-otf
- name: Install requirements - name: Install requirements
run: | run: |
pip install -r docs/requirements.txt pip install -r lvgl/docs/requirements.txt
- name: Setup Emscripten cache - name: Setup Emscripten cache
id: cache-system-libraries id: cache-system-libraries
uses: actions/cache@v4 uses: actions/cache@v4
@@ -63,16 +64,14 @@ jobs:
uses: hendrikmuhs/ccache-action@v1 uses: hendrikmuhs/ccache-action@v1
- name: Build examples (with cache) - name: Build examples (with cache)
run: | run: |
REPO_URL="${{ github.server_url }}/${{ github.repository }}" ./lvgl/scripts/build_html_examples.sh --symlink "${PWD}/lvgl"
COMMIT_REF="${{ github.sha }}"
./scripts/build_html_examples.sh "$REPO_URL" "$COMMIT_REF"
- name: Build docs - name: Build docs
run: docs/build.py html run: lvgl/docs/build.py html
- name: Remove .doctrees - name: Remove .doctrees
run: rm -rf docs/build/html/.doctrees run: rm -rf lvgl/docs/build/html/.doctrees
- name: Retrieve version - name: Retrieve version
run: | run: |
echo "::set-output name=VERSION_NAME::$(scripts/find_version.sh)" echo "::set-output name=VERSION_NAME::$(lvgl/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' }} if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
@@ -81,7 +80,7 @@ jobs:
token: ${{ secrets.LVGL_BOT_TOKEN }} token: ${{ secrets.LVGL_BOT_TOKEN }}
repository-name: lvgl/docs repository-name: lvgl/docs
branch: gh-pages # The branch the action should deploy to. branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy. folder: lvgl/docs/build/html # The folder the action should deploy.
target-folder: ${{ steps.version.outputs.VERSION_NAME }} target-folder: ${{ steps.version.outputs.VERSION_NAME }}
git-config-name: lvgl-bot git-config-name: lvgl-bot
git-config-email: lvgl-bot@users.noreply.github.com git-config-email: lvgl-bot@users.noreply.github.com
@@ -93,7 +92,7 @@ jobs:
token: ${{ secrets.LVGL_BOT_TOKEN }} token: ${{ secrets.LVGL_BOT_TOKEN }}
repository-name: lvgl/docs repository-name: lvgl/docs
branch: gh-pages # The branch the action should deploy to. branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy. folder: lvgl/docs/build/html # The folder the action should deploy.
target-folder: master target-folder: master
git-config-name: lvgl-bot git-config-name: lvgl-bot
git-config-email: lvgl-bot@users.noreply.github.com git-config-email: lvgl-bot@users.noreply.github.com
+28 -16
View File
@@ -5,27 +5,34 @@ set -e
# These variables allow us to specify an alternate repository URL and commit reference # 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 # This is particularly useful when running in CI environments for pull requests
# where we need to build from the contributor's forked repository # where we need to build from the contributor's forked repository
REPO_URL="${1:-}" ARG_1="${1:-}"
COMMIT_REF="${2:-}" ARG_2="${2:-}"
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
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
cd emscripten_builder cd emscripten_builder
git submodule update --init -- lvgl if [ "$ARG_1" != "--symlink" ]; then
cd lvgl REPO_URL="$ARG_1"
if [ -n "$REPO_URL" ] && [ -n "$COMMIT_REF" ]; then COMMIT_REF="$ARG_2"
echo "Using provided repo URL: $REPO_URL and commit ref: $COMMIT_REF for lvgl submodule" git submodule update --init -- lvgl
git remote set-url origin "$REPO_URL" if [ -n "$REPO_URL" ] && [ -n "$COMMIT_REF" ]; then
git fetch origin cd lvgl
git fetch origin '+refs/pull/*:refs/remotes/origin/pull/*' echo "Using provided repo URL: $REPO_URL and commit ref: $COMMIT_REF for lvgl submodule"
git checkout "$COMMIT_REF" git remote set-url origin "$REPO_URL"
git fetch origin
git checkout "$COMMIT_REF"
cd ..
fi
else else
CURRENT_REF="$(git rev-parse HEAD)" SYMLINK_TARGET="$ARG_2"
echo "Using current commit ref: $CURRENT_REF for lvgl" echo "Using provided symbolic link to LVGL directory (should be absolute): $SYMLINK_TARGET"
git checkout "$CURRENT_REF" rmdir lvgl # remove the uninitialized submodule empty dir
ln -s -T "$SYMLINK_TARGET" lvgl
fi fi
cd lvgl
scripts/genexamplelist.sh > ../examplelist.c
cd .. cd ..
# Generate lv_conf # Generate lv_conf
@@ -41,5 +48,10 @@ cd cmbuild
emcmake cmake .. -DLV_BUILD_CONF_PATH=$LV_CONF_PATH -DLVGL_CHOSEN_DEMO=lv_example_noop -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache emcmake cmake .. -DLV_BUILD_CONF_PATH=$LV_CONF_PATH -DLVGL_CHOSEN_DEMO=lv_example_noop -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
emmake make -j$(nproc) emmake make -j$(nproc)
rm -rf CMakeFiles rm -rf CMakeFiles
cd ../.. cd ..
cp -a emscripten_builder/cmbuild docs/src/_static/built_lv_examples if [ "$ARG_1" != "--symlink" ]; then
cp -a cmbuild ../docs/src/_static/built_lv_examples
else
cp -a cmbuild lvgl/docs/src/_static/built_lv_examples
fi
cd ..