Skip to content

Commit

Permalink
Automatically build Emscripten versions of examples
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Sep 23, 2020
1 parent 375c7a4 commit 4a6def8
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Deploy
env:
EM_VERSION: 1.39.18
EM_CACHE_FOLDER: 'emsdk-cache'
on:
push:
branches: [ master ]
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '*/15 * * * *'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup cache
id: cache-system-libraries
uses: actions/cache@v2
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}
- uses: mymindstorm/setup-emsdk@v6
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Build demo
run: scripts/build_all_examples.sh ${{ env.GITHUB_SHA }}
- name: Remove builder folder
run: rm -rf objs/builder
- name: Deploy
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: objs # The folder the action should deploy.
CLEAN: true # Automatically remove deleted files from the deploy branch
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/*.o
**/*.o
objs
32 changes: 32 additions & 0 deletions scripts/build_all_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

GIT_HASH=$1

if [ "x$GIT_HASH" == "" ]; then
GIT_HASH=$(git rev-parse HEAD)
fi

mkdir -p objs
cd objs
echo "-- Updating builder ..."
OBJS_DIR=`pwd`
if ! [ -d builder ]; then
git clone --quiet --recursive https://github.com/lvgl/lv_sim_emscripten.git builder
cd builder
else
cd builder
git pull --quiet
fi
cd lv_examples
echo "-- Checking out lv_examples $GIT_HASH ..."
git checkout $GIT_HASH
cd ..
echo "<html><body><h1>Choose an example:</h1><ul>" > $OBJS_DIR/index.html
cat $OBJS_DIR/../scripts/examples.txt | while read -r example_name; do
echo "-- Building $example_name ..."
make -j4 CHOSEN_DEMO=$example_name NO_GIT_HASH=1 || exit 1
rm -rf $OBJS_DIR/$example_name
cp -a build $OBJS_DIR/$example_name
echo "<li><a href=\"$example_name/index.html\">$example_name</a></li>" >> $OBJS_DIR/index.html
done
echo "</ul></body></html>" >> $OBJS_DIR/index.html
2 changes: 2 additions & 0 deletions scripts/examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lv_demo_widgets
lv_demo_stress

0 comments on commit 4a6def8

Please sign in to comment.