@@ -10,39 +10,108 @@ jobs:
10
10
build-and-deploy :
11
11
runs-on : ubuntu-latest
12
12
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
16
16
17
17
steps :
18
18
- name : Checkout current repository
19
19
uses : actions/checkout@v4
20
20
with :
21
21
path : " current-repo"
22
22
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
+
23
29
- name : Setup Node.js
24
30
uses : actions/setup-node@v4
25
31
with :
26
32
node-version : " 18"
27
33
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
+
28
41
- name : Clone editor-online-preview repository
29
42
run : |
30
43
git clone https://github.com/lvgl-private/editor-test-preview.git /tmp/editor-preview
31
44
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
+
32
57
- name : Prepare preview files
33
58
run : |
34
- # Create project directory in the preview
35
59
mkdir -p /tmp/editor-preview/project
36
- # Copy current repo contents to project directory
37
60
cp -r current-repo/* /tmp/editor-preview/project/
38
61
39
62
- name : Generate manifest file
40
63
run : |
41
64
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/'
43
93
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'
46
115
47
116
- name : Upload artifact
48
117
uses : actions/upload-pages-artifact@v3
51
120
52
121
- name : Deploy to GitHub Pages
53
122
uses : actions/deploy-pages@v4
54
- with :
55
- path : /tmp/editor-preview
0 commit comments