2020-08-17 11:31:07 +00:00
|
|
|
# GitHub Actions Workflow to build PineTime Watch Face Simulator with LVGL and WebAssembly
|
2020-08-17 10:58:03 +00:00
|
|
|
# See https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud
|
|
|
|
# Based on https://github.com/JF002/Pinetime/blob/master/doc/buildAndProgram.md
|
|
|
|
# and https://github.com/JF002/Pinetime/blob/master/bootloader/README.md
|
|
|
|
|
|
|
|
# Name of this Workflow
|
|
|
|
name: Simulate PineTime Firmware
|
|
|
|
|
|
|
|
# When to run this Workflow...
|
|
|
|
on:
|
|
|
|
|
|
|
|
# Run this Workflow when files are updated (Pushed) in the "master" Branch
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
# Also run this Workflow when a Pull Request is created or updated in the "master" Branch
|
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
# Steps to run for the Workflow
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
# Run these steps on Ubuntu
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2020-08-17 17:20:56 +00:00
|
|
|
# Uncomment the next 2 steps to support Rust WebAssembly
|
|
|
|
# - name: Fetch cache for Rust Toolchain
|
|
|
|
# id: cache-rust
|
|
|
|
# uses: actions/cache@v2
|
|
|
|
# with:
|
|
|
|
# path: |
|
|
|
|
# ~/.cargo/registry
|
|
|
|
# ~/.cargo/git
|
|
|
|
# target
|
|
|
|
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
# - name: Install Rust Toolchain for emscripten
|
|
|
|
# run: |
|
|
|
|
# rustup default nightly
|
|
|
|
# rustup target add wasm32-unknown-emscripten
|
2020-08-17 10:58:03 +00:00
|
|
|
|
|
|
|
- name: Check cache for emscripten
|
|
|
|
id: cache-emsdk
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-emsdk
|
|
|
|
with:
|
|
|
|
path: /tmp/emsdk
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}
|
|
|
|
|
|
|
|
- name: Install emscripten
|
|
|
|
if: steps.cache-emsdk.outputs.cache-hit != 'true' # Install emscripten if not found in cache
|
|
|
|
run: |
|
|
|
|
# Based on https://emscripten.org/docs/getting_started/downloads.html
|
|
|
|
cd /tmp
|
|
|
|
|
|
|
|
# Get the emsdk repo
|
|
|
|
git clone https://github.com/emscripten-core/emsdk.git
|
|
|
|
|
|
|
|
# Enter that directory
|
|
|
|
cd emsdk
|
|
|
|
|
|
|
|
# Download and install the latest SDK tools.
|
|
|
|
./emsdk install latest
|
|
|
|
|
|
|
|
# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
|
|
|
|
./emsdk activate latest
|
|
|
|
|
|
|
|
# Activate PATH and other environment variables in the current terminal
|
|
|
|
source ./emsdk_env.sh
|
|
|
|
|
|
|
|
# Show version
|
|
|
|
emcc --version
|
|
|
|
emcc --version
|
|
|
|
|
|
|
|
- name: Check cache for wabt
|
|
|
|
id: cache-wabt
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-wabt
|
|
|
|
with:
|
|
|
|
path: /tmp/wabt
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}
|
|
|
|
|
|
|
|
- name: Install wabt
|
|
|
|
if: steps.cache-wabt.outputs.cache-hit != 'true' # Install wabt if not found in cache
|
|
|
|
run: |
|
|
|
|
cd /tmp
|
|
|
|
git clone --recursive https://github.com/WebAssembly/wabt
|
|
|
|
cd wabt
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake ..
|
|
|
|
cmake --build .
|
|
|
|
|
2020-08-17 11:02:30 +00:00
|
|
|
- name: Checkout LVGL for WebAssembly
|
|
|
|
run: |
|
|
|
|
cd /tmp
|
|
|
|
git clone https://github.com/AppKaki/lvgl-wasm
|
|
|
|
|
2020-08-17 11:13:06 +00:00
|
|
|
- name: Copy Watch Face Clock.cpp to LVGL for WebAssembly
|
2020-08-17 11:02:30 +00:00
|
|
|
run: |
|
2020-08-17 11:13:06 +00:00
|
|
|
cp src/DisplayApp/Screens/Clock.cpp /tmp/lvgl-wasm/clock
|
2020-08-17 11:02:30 +00:00
|
|
|
|
|
|
|
- name: Build LVGL for WebAssembly
|
2020-08-17 10:58:03 +00:00
|
|
|
run: |
|
|
|
|
# Add emscripten and wabt to the PATH
|
|
|
|
source /tmp/emsdk/emsdk_env.sh
|
|
|
|
export PATH=$PATH:/tmp/wabt/build
|
|
|
|
|
|
|
|
# Build LVGL app: wasm/lvgl.html, lvgl.js, lvgl.wasm
|
2020-08-17 11:02:30 +00:00
|
|
|
cd /tmp/lvgl-wasm
|
2020-08-17 10:58:03 +00:00
|
|
|
wasm/lvgl.sh
|
|
|
|
|
2020-08-17 11:13:06 +00:00
|
|
|
- name: Show files
|
|
|
|
run: set ; pwd ; ls -l /tmp/lvgl-wasm
|
|
|
|
|
|
|
|
- name: Copy WebAssembly to GitHub Pages
|
2020-08-17 11:02:30 +00:00
|
|
|
run: |
|
2020-08-17 11:13:06 +00:00
|
|
|
if [ ! -d docs ]; then
|
|
|
|
mkdir docs
|
|
|
|
fi
|
2020-08-17 17:35:00 +00:00
|
|
|
export src=/tmp/lvgl-wasm
|
|
|
|
export docs=$src/docs
|
|
|
|
export wasm=$src/wasm
|
|
|
|
cp \
|
|
|
|
$docs/index.md \
|
|
|
|
$docs/lvgl.html \
|
|
|
|
$wasm/*.html \
|
|
|
|
$wasm/*.js \
|
|
|
|
$wasm/*.wasm \
|
|
|
|
$wasm/*.txt \
|
|
|
|
docs
|
2020-08-17 11:02:30 +00:00
|
|
|
|
|
|
|
- name: Commit GitHub Pages
|
2020-08-17 17:25:59 +00:00
|
|
|
uses: EndBug/add-and-commit@v4.4.0
|
|
|
|
with:
|
|
|
|
# Arguments for the git add command
|
|
|
|
add: docs
|
|
|
|
# The name of the user that will be displayed as the author of the commit
|
|
|
|
# author_name: # optional
|
|
|
|
# The email of the user that will be displayed as the author of the commit
|
|
|
|
# author_email: # optional
|
|
|
|
# The directory where your repository is located. You should use actions/checkout first to set it up
|
|
|
|
# cwd: # optional, default is .
|
|
|
|
# Whether to use the force option on git add, in order to bypass eventual gitignores
|
|
|
|
# force: # optional, default is false
|
|
|
|
# Whether to use the signoff option on git commit
|
|
|
|
# signoff: # optional, default is false
|
|
|
|
# The message for the commit
|
|
|
|
# message: # optional, default is Commit from GitHub Actions
|
|
|
|
# Name of the branch to use, if different from the one that triggered the workflow
|
|
|
|
# ref: # optional
|
|
|
|
# Arguments for the git rm command
|
|
|
|
# remove: # optional, default is
|
|
|
|
# The name of the tag to add to the new commit
|
|
|
|
# tag: # optional, default is
|
2020-08-17 11:02:30 +00:00
|
|
|
|
2020-08-17 10:58:03 +00:00
|
|
|
- name: Upload Outputs
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: wasm
|
|
|
|
path: |
|
2020-08-17 11:18:45 +00:00
|
|
|
/tmp/lvgl-wasm/wasm/*.html
|
|
|
|
/tmp/lvgl-wasm/wasm/*.js
|
|
|
|
/tmp/lvgl-wasm/wasm/*.wasm
|
|
|
|
/tmp/lvgl-wasm/wasm/*.txt
|