Skip to content

Commit 63a74ea

Browse files
committed
feat: Update tests file
1 parent 8c44da0 commit 63a74ea

File tree

1 file changed

+77
-10
lines changed

1 file changed

+77
-10
lines changed

.github/workflows/publish-tests.yml

Lines changed: 77 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,108 @@ jobs:
1010
build-and-deploy:
1111
runs-on: ubuntu-latest
1212
permissions:
13-
contents: write # Required for pushing to gh-pages
14-
pages: write # Required for deploying to Pages
15-
id-token: write # Required for deploying to Pages
13+
contents: write
14+
pages: write
15+
id-token: write
1616

1717
steps:
1818
- name: Checkout current repository
1919
uses: actions/checkout@v4
2020
with:
2121
path: "current-repo"
2222

23+
- name: Set up Docker
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Pull Docker image
27+
run: docker pull coevin/emscripten-sdl2:main
28+
2329
- name: Setup Node.js
2430
uses: actions/setup-node@v4
2531
with:
2632
node-version: "18"
2733

34+
# Get LVGL PR latest commit hash
35+
- name: Get LVGL PR latest commit
36+
id: lvgl-commit
37+
run: |
38+
COMMIT_HASH=$(curl -s https://api.github.com/repos/lvgl/lvgl/pulls/7417 | jq -r .head.sha)
39+
echo "commit_hash=${COMMIT_HASH}" >> $GITHUB_OUTPUT
40+
2841
- name: Clone editor-online-preview repository
2942
run: |
3043
git clone https://github.com/lvgl-private/editor-test-preview.git /tmp/editor-preview
3144
45+
- name: Clone LVGL PR
46+
run: |
47+
# Create runtime directory
48+
mkdir -p /tmp/runtime
49+
# Copy resources to runtime directory
50+
cp -r /tmp/editor-preview/resources/* /tmp/runtime/
51+
# Clone LVGL PR
52+
git clone https://github.com/lvgl/lvgl.git /tmp/runtime/lvgl
53+
cd /tmp/runtime/lvgl
54+
git fetch origin pull/7417/head:pr-7417
55+
git checkout pr-7417
56+
3257
- name: Prepare preview files
3358
run: |
34-
# Create project directory in the preview
3559
mkdir -p /tmp/editor-preview/project
36-
# Copy current repo contents to project directory
3760
cp -r current-repo/* /tmp/editor-preview/project/
3861
3962
- name: Generate manifest file
4063
run: |
4164
cd /tmp/editor-preview
42-
node generateProjectManifest.js ./project/ "project/"
65+
node generateProjectManifest.js ./project/ /project/
66+
67+
- name: Prepare widget list
68+
id: widget-list
69+
run: |
70+
WIDGET_LIST="[]"
71+
if [ -d "current-repo/widgets" ]; then
72+
# Find directories in widgets that contain .c files
73+
WIDGETS=$(find current-repo/widgets -type f -name "*.c" -exec dirname {} \; | sort -u | xargs -n1 basename)
74+
if [ ! -z "$WIDGETS" ]; then
75+
# Convert to array of '_widgetname_register'
76+
WIDGET_LIST="[$(echo "$WIDGETS" | tr ' ' '\n' | sed "s/.*/'_&_register'/" | tr '\n' ',' | sed 's/,$//' )]"
77+
fi
78+
fi
79+
echo "widget_functions=$WIDGET_LIST" >> $GITHUB_OUTPUT
80+
81+
- name: Build LVGL library
82+
run: |
83+
docker run --rm \
84+
-v /tmp/runtime:/work \
85+
-w /work/lib \
86+
coevin/emscripten-sdl2:main \
87+
sh -c 'mkdir -p /tmp/build && \
88+
cd /tmp/build && \
89+
emcmake cmake /work/lib && \
90+
emmake make -j8 && \
91+
mkdir -p /work/lib && \
92+
cp /tmp/build/liblvgl.a /work/lib/'
4393
44-
- name: Setup Pages
45-
uses: actions/configure-pages@v4
94+
- name: Build runtime
95+
run: |
96+
# Create build directory
97+
mkdir -p /tmp/build
98+
99+
# Run CMake in Docker
100+
docker run --rm \
101+
-v /tmp/runtime:/work \
102+
-v /tmp/editor-preview/project/resources:/output \
103+
-v /tmp/build:/build \
104+
-v ${{ github.workspace }}/current-repo:/user_src \
105+
-w /build \
106+
coevin/emscripten-sdl2:main \
107+
sh -c 'emcmake cmake -DPROJECT_NAME=lved-runtime \
108+
-DOUTPUT_DIR=/output \
109+
-DLVGL_SRC_DIR=/work/lvgl \
110+
-DLVGL_CONF_DIR=/work/conf \
111+
-DUSER_SRC_DIR=/user_src \
112+
-DADDITIONAL_EXPORTED_FUNCTIONS="${{ steps.widget-list.outputs.widget_functions }}" \
113+
/work && \
114+
emmake make -j8'
46115
47116
- name: Upload artifact
48117
uses: actions/upload-pages-artifact@v3
@@ -51,5 +120,3 @@ jobs:
51120

52121
- name: Deploy to GitHub Pages
53122
uses: actions/deploy-pages@v4
54-
with:
55-
path: /tmp/editor-preview

0 commit comments

Comments
 (0)