summaryrefslogtreecommitdiff
path: root/.github/workflows/simulate.yml
diff options
context:
space:
mode:
authorLee Lup Yuen <luppy@appkaki.com>2020-08-17 10:58:03 (GMT)
committerGitHub <noreply@github.com>2020-08-17 10:58:03 (GMT)
commitafcaa405054854b8790ca17fa0a69dd59e960948 (patch)
tree19f7b00763ad1476bcc0d7962ba6593786665572 /.github/workflows/simulate.yml
parenta17261f0a7aca0d00dc96685a5c99cd643b19fe7 (diff)
Create simulate.yml
Copy from https://github.com/lupyuen/pinetime-lab/blob/master/.github/workflows/main.yml
Diffstat (limited to '.github/workflows/simulate.yml')
-rw-r--r--.github/workflows/simulate.yml121
1 files changed, 121 insertions, 0 deletions
diff --git a/.github/workflows/simulate.yml b/.github/workflows/simulate.yml
new file mode 100644
index 0000000..66cbbe7
--- /dev/null
+++ b/.github/workflows/simulate.yml
@@ -0,0 +1,121 @@
+# GitHub Actions Workflow to build FreeRTOS Firmware for PineTime Smart Watch
+# 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
+
+ - 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
+
+ - 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 .
+
+ - name: Build LVGL
+ 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
+ wasm/lvgl.sh
+
+ - name: Show files
+ run: set ; pwd ; ls -l
+
+ - name: Upload Outputs
+ uses: actions/upload-artifact@v2
+ with:
+ name: wasm
+ path: |
+ wasm/*.html
+ wasm/*.js
+ wasm/*.wasm
+ wasm/*.txt