From a754f6e3a8197f37043cf2e53e2a6a61fea16b38 Mon Sep 17 00:00:00 2001 From: Richard Gazdik Date: Thu, 12 Dec 2024 13:55:03 +0100 Subject: [PATCH] fix: revert back to have a working examples folder --- .github/workflows/publish-tests.yml | 125 ++---------------- .../components}/buttons/button_default.xml | 0 .../components}/buttons/button_error.xml | 0 .../components}/buttons/button_warning.xml | 0 .../components}/headings/h1.xml | 0 .../components}/headings/h2.xml | 0 .../components}/headings/h3.xml | 0 {components => examples/components}/home.xml | 0 .../components}/scratchpad.xml | 0 example.c => examples/example.c | 0 example.h => examples/example.h | 0 {fonts => examples/fonts}/Inter-SemiBold.ttf | Bin globals.xml => examples/globals.xml | 0 {images => examples/images}/lvgl.bmp | Bin {images => examples/images}/lvgl.png | Bin {images => examples/images}/screenshot.png | Bin {images => examples/images}/wink.png | Bin {tests => examples/tests}/test2.lvml | 0 {tests => examples/tests}/tests.lvml | 0 ui.c => examples/ui.c | 0 ui.h => examples/ui.h | 0 .../widgets}/dark_slider/dark_slider.c | 0 .../widgets}/dark_slider/dark_slider.h | 0 .../widgets}/dark_slider/dark_slider.xml | 0 .../widgets}/dark_slider/dark_slider_gen.c | 0 .../widgets}/dark_slider/dark_slider_gen.h | 0 .../dark_slider/dark_slider_private_gen.h | 0 .../dark_slider/dark_slider_xml_parser.c | 0 .../widgets}/slider_box/slider_box.c | 0 .../widgets}/slider_box/slider_box.h | 0 .../widgets}/slider_box/slider_box.xml | 0 .../widgets}/slider_box/slider_box_gen.c | 0 .../widgets}/slider_box/slider_box_gen.h | 0 .../slider_box/slider_box_private_gen.h | 0 .../slider_box/slider_box_xml_parser.c | 0 35 files changed, 10 insertions(+), 115 deletions(-) rename {components => examples/components}/buttons/button_default.xml (100%) rename {components => examples/components}/buttons/button_error.xml (100%) rename {components => examples/components}/buttons/button_warning.xml (100%) rename {components => examples/components}/headings/h1.xml (100%) rename {components => examples/components}/headings/h2.xml (100%) rename {components => examples/components}/headings/h3.xml (100%) rename {components => examples/components}/home.xml (100%) rename {components => examples/components}/scratchpad.xml (100%) rename example.c => examples/example.c (100%) rename example.h => examples/example.h (100%) rename {fonts => examples/fonts}/Inter-SemiBold.ttf (100%) rename globals.xml => examples/globals.xml (100%) rename {images => examples/images}/lvgl.bmp (100%) rename {images => examples/images}/lvgl.png (100%) rename {images => examples/images}/screenshot.png (100%) rename {images => examples/images}/wink.png (100%) rename {tests => examples/tests}/test2.lvml (100%) rename {tests => examples/tests}/tests.lvml (100%) rename ui.c => examples/ui.c (100%) rename ui.h => examples/ui.h (100%) rename {widgets => examples/widgets}/dark_slider/dark_slider.c (100%) rename {widgets => examples/widgets}/dark_slider/dark_slider.h (100%) rename {widgets => examples/widgets}/dark_slider/dark_slider.xml (100%) rename {widgets => examples/widgets}/dark_slider/dark_slider_gen.c (100%) rename {widgets => examples/widgets}/dark_slider/dark_slider_gen.h (100%) rename {widgets => examples/widgets}/dark_slider/dark_slider_private_gen.h (100%) rename {widgets => examples/widgets}/dark_slider/dark_slider_xml_parser.c (100%) rename {widgets => examples/widgets}/slider_box/slider_box.c (100%) rename {widgets => examples/widgets}/slider_box/slider_box.h (100%) rename {widgets => examples/widgets}/slider_box/slider_box.xml (100%) rename {widgets => examples/widgets}/slider_box/slider_box_gen.c (100%) rename {widgets => examples/widgets}/slider_box/slider_box_gen.h (100%) rename {widgets => examples/widgets}/slider_box/slider_box_private_gen.h (100%) rename {widgets => examples/widgets}/slider_box/slider_box_xml_parser.c (100%) diff --git a/.github/workflows/publish-tests.yml b/.github/workflows/publish-tests.yml index 5c9a661..394ee69 100644 --- a/.github/workflows/publish-tests.yml +++ b/.github/workflows/publish-tests.yml @@ -10,9 +10,9 @@ jobs: build-and-deploy: runs-on: ubuntu-latest permissions: - contents: write - pages: write - id-token: write + contents: write # Required for pushing to gh-pages + pages: write # Required for deploying to Pages + id-token: write # Required for deploying to Pages steps: - name: Checkout current repository @@ -20,136 +20,29 @@ jobs: with: path: "current-repo" - # Cache Docker images - - name: Cache Docker images - uses: ScribeMD/docker-cache@0.3.7 - with: - key: docker-${{ runner.os }}-${{ hashFiles('current-repo/**/*.c', 'current-repo/**/*.h') }} - - - name: Set up Docker - uses: docker/setup-buildx-action@v3 - - - name: Pull Docker image - run: docker pull coevin/emscripten-sdl2:main - - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: "18" - # Get LVGL PR latest commit hash - - name: Get LVGL PR latest commit - id: lvgl-commit - run: | - COMMIT_HASH=$(curl -s https://api.github.com/repos/lvgl/lvgl/pulls/7417 | jq -r .head.sha) - echo "commit_hash=${COMMIT_HASH}" >> $GITHUB_OUTPUT - - # Cache LVGL PR with commit hash in key - - name: Cache LVGL PR - id: cache-lvgl - uses: actions/cache@v3 - with: - path: /tmp/runtime/lvgl - key: lvgl-pr7417-${{ steps.lvgl-commit.outputs.commit_hash }} - - name: Clone editor-online-preview repository run: | git clone https://github.com/lvgl-private/editor-test-preview.git /tmp/editor-preview - - name: Clone LVGL PR - if: steps.cache-lvgl.outputs.cache-hit != 'true' - run: | - # Create runtime directory - mkdir -p /tmp/runtime - # Copy resources to runtime directory - cp -r /tmp/editor-preview/resources/* /tmp/runtime/ - # Clone LVGL PR - git clone https://github.com/lvgl/lvgl.git /tmp/runtime/lvgl - cd /tmp/runtime/lvgl - git fetch origin pull/7417/head:pr-7417 - git checkout pr-7417 - - - name: Copy resources if using cached LVGL - if: steps.cache-lvgl.outputs.cache-hit == 'true' - run: | - mkdir -p /tmp/runtime - cp -r /tmp/editor-preview/resources/* /tmp/runtime/ - - # Cache build directory with LVGL commit hash - - name: Cache build directory - id: cache-build - uses: actions/cache@v3 - with: - path: /tmp/build - key: build-${{ runner.os }}-${{ steps.lvgl-commit.outputs.commit_hash }}-${{ hashFiles('current-repo/**/*.c', 'current-repo/**/*.h') }} - - name: Prepare preview files run: | + # Create project directory in the preview mkdir -p /tmp/editor-preview/project + # Copy current repo contents to project directory cp -r current-repo/* /tmp/editor-preview/project/ - name: Generate manifest file run: | cd /tmp/editor-preview - node generateProjectManifest.js ./project/ /project/ - - - name: Prepare widget list - id: widget-list - run: | - WIDGET_LIST="[]" - if [ -d "current-repo/widgets" ]; then - # Find directories in widgets that contain .c files - WIDGETS=$(find current-repo/widgets -type f -name "*.c" -exec dirname {} \; | sort -u | xargs -n1 basename) - if [ ! -z "$WIDGETS" ]; then - # Convert to array of '_widgetname_register' - WIDGET_LIST="[$(echo "$WIDGETS" | tr ' ' '\n' | sed "s/.*/'_&_register'/" | tr '\n' ',' | sed 's/,$//' )]" - fi - fi - echo "widget_functions=$WIDGET_LIST" >> $GITHUB_OUTPUT - - # Cache LVGL library - - name: Cache LVGL library - id: cache-lvgl-lib - uses: actions/cache@v3 - with: - path: /tmp/runtime/lib/liblvgl.a - key: lvgl-lib-${{ steps.lvgl-commit.outputs.commit_hash }} + node generateProjectManifest.js ./project/ "project/" - - name: Build LVGL library - if: steps.cache-lvgl-lib.outputs.cache-hit != 'true' - run: | - docker run --rm \ - -v /tmp/runtime:/work \ - -w /work/lib \ - coevin/emscripten-sdl2:main \ - sh -c 'mkdir -p /tmp/build && \ - cd /tmp/build && \ - emcmake cmake /work/lib && \ - emmake make -j8 && \ - mkdir -p /work/lib && \ - cp /tmp/build/liblvgl.a /work/lib/' - - - name: Build runtime - run: | - # Create build directory - mkdir -p /tmp/build - - # Run CMake in Docker - docker run --rm \ - -v /tmp/runtime:/work \ - -v /tmp/editor-preview/project/resources:/output \ - -v /tmp/build:/build \ - -v ${{ github.workspace }}/current-repo:/user_src \ - -w /build \ - coevin/emscripten-sdl2:main \ - sh -c 'emcmake cmake -DPROJECT_NAME=lved-runtime \ - -DOUTPUT_DIR=/output \ - -DLVGL_SRC_DIR=/work/lvgl \ - -DLVGL_CONF_DIR=/work/conf \ - -DUSER_SRC_DIR=/user_src \ - -DADDITIONAL_EXPORTED_FUNCTIONS="${{ steps.widget-list.outputs.widget_functions }}" \ - /work && \ - emmake make -j8' + - name: Setup Pages + uses: actions/configure-pages@v4 - name: Upload artifact uses: actions/upload-pages-artifact@v3 @@ -158,3 +51,5 @@ jobs: - name: Deploy to GitHub Pages uses: actions/deploy-pages@v4 + with: + path: /tmp/editor-preview diff --git a/components/buttons/button_default.xml b/examples/components/buttons/button_default.xml similarity index 100% rename from components/buttons/button_default.xml rename to examples/components/buttons/button_default.xml diff --git a/components/buttons/button_error.xml b/examples/components/buttons/button_error.xml similarity index 100% rename from components/buttons/button_error.xml rename to examples/components/buttons/button_error.xml diff --git a/components/buttons/button_warning.xml b/examples/components/buttons/button_warning.xml similarity index 100% rename from components/buttons/button_warning.xml rename to examples/components/buttons/button_warning.xml diff --git a/components/headings/h1.xml b/examples/components/headings/h1.xml similarity index 100% rename from components/headings/h1.xml rename to examples/components/headings/h1.xml diff --git a/components/headings/h2.xml b/examples/components/headings/h2.xml similarity index 100% rename from components/headings/h2.xml rename to examples/components/headings/h2.xml diff --git a/components/headings/h3.xml b/examples/components/headings/h3.xml similarity index 100% rename from components/headings/h3.xml rename to examples/components/headings/h3.xml diff --git a/components/home.xml b/examples/components/home.xml similarity index 100% rename from components/home.xml rename to examples/components/home.xml diff --git a/components/scratchpad.xml b/examples/components/scratchpad.xml similarity index 100% rename from components/scratchpad.xml rename to examples/components/scratchpad.xml diff --git a/example.c b/examples/example.c similarity index 100% rename from example.c rename to examples/example.c diff --git a/example.h b/examples/example.h similarity index 100% rename from example.h rename to examples/example.h diff --git a/fonts/Inter-SemiBold.ttf b/examples/fonts/Inter-SemiBold.ttf similarity index 100% rename from fonts/Inter-SemiBold.ttf rename to examples/fonts/Inter-SemiBold.ttf diff --git a/globals.xml b/examples/globals.xml similarity index 100% rename from globals.xml rename to examples/globals.xml diff --git a/images/lvgl.bmp b/examples/images/lvgl.bmp similarity index 100% rename from images/lvgl.bmp rename to examples/images/lvgl.bmp diff --git a/images/lvgl.png b/examples/images/lvgl.png similarity index 100% rename from images/lvgl.png rename to examples/images/lvgl.png diff --git a/images/screenshot.png b/examples/images/screenshot.png similarity index 100% rename from images/screenshot.png rename to examples/images/screenshot.png diff --git a/images/wink.png b/examples/images/wink.png similarity index 100% rename from images/wink.png rename to examples/images/wink.png diff --git a/tests/test2.lvml b/examples/tests/test2.lvml similarity index 100% rename from tests/test2.lvml rename to examples/tests/test2.lvml diff --git a/tests/tests.lvml b/examples/tests/tests.lvml similarity index 100% rename from tests/tests.lvml rename to examples/tests/tests.lvml diff --git a/ui.c b/examples/ui.c similarity index 100% rename from ui.c rename to examples/ui.c diff --git a/ui.h b/examples/ui.h similarity index 100% rename from ui.h rename to examples/ui.h diff --git a/widgets/dark_slider/dark_slider.c b/examples/widgets/dark_slider/dark_slider.c similarity index 100% rename from widgets/dark_slider/dark_slider.c rename to examples/widgets/dark_slider/dark_slider.c diff --git a/widgets/dark_slider/dark_slider.h b/examples/widgets/dark_slider/dark_slider.h similarity index 100% rename from widgets/dark_slider/dark_slider.h rename to examples/widgets/dark_slider/dark_slider.h diff --git a/widgets/dark_slider/dark_slider.xml b/examples/widgets/dark_slider/dark_slider.xml similarity index 100% rename from widgets/dark_slider/dark_slider.xml rename to examples/widgets/dark_slider/dark_slider.xml diff --git a/widgets/dark_slider/dark_slider_gen.c b/examples/widgets/dark_slider/dark_slider_gen.c similarity index 100% rename from widgets/dark_slider/dark_slider_gen.c rename to examples/widgets/dark_slider/dark_slider_gen.c diff --git a/widgets/dark_slider/dark_slider_gen.h b/examples/widgets/dark_slider/dark_slider_gen.h similarity index 100% rename from widgets/dark_slider/dark_slider_gen.h rename to examples/widgets/dark_slider/dark_slider_gen.h diff --git a/widgets/dark_slider/dark_slider_private_gen.h b/examples/widgets/dark_slider/dark_slider_private_gen.h similarity index 100% rename from widgets/dark_slider/dark_slider_private_gen.h rename to examples/widgets/dark_slider/dark_slider_private_gen.h diff --git a/widgets/dark_slider/dark_slider_xml_parser.c b/examples/widgets/dark_slider/dark_slider_xml_parser.c similarity index 100% rename from widgets/dark_slider/dark_slider_xml_parser.c rename to examples/widgets/dark_slider/dark_slider_xml_parser.c diff --git a/widgets/slider_box/slider_box.c b/examples/widgets/slider_box/slider_box.c similarity index 100% rename from widgets/slider_box/slider_box.c rename to examples/widgets/slider_box/slider_box.c diff --git a/widgets/slider_box/slider_box.h b/examples/widgets/slider_box/slider_box.h similarity index 100% rename from widgets/slider_box/slider_box.h rename to examples/widgets/slider_box/slider_box.h diff --git a/widgets/slider_box/slider_box.xml b/examples/widgets/slider_box/slider_box.xml similarity index 100% rename from widgets/slider_box/slider_box.xml rename to examples/widgets/slider_box/slider_box.xml diff --git a/widgets/slider_box/slider_box_gen.c b/examples/widgets/slider_box/slider_box_gen.c similarity index 100% rename from widgets/slider_box/slider_box_gen.c rename to examples/widgets/slider_box/slider_box_gen.c diff --git a/widgets/slider_box/slider_box_gen.h b/examples/widgets/slider_box/slider_box_gen.h similarity index 100% rename from widgets/slider_box/slider_box_gen.h rename to examples/widgets/slider_box/slider_box_gen.h diff --git a/widgets/slider_box/slider_box_private_gen.h b/examples/widgets/slider_box/slider_box_private_gen.h similarity index 100% rename from widgets/slider_box/slider_box_private_gen.h rename to examples/widgets/slider_box/slider_box_private_gen.h diff --git a/widgets/slider_box/slider_box_xml_parser.c b/examples/widgets/slider_box/slider_box_xml_parser.c similarity index 100% rename from widgets/slider_box/slider_box_xml_parser.c rename to examples/widgets/slider_box/slider_box_xml_parser.c