Skip to content

DanielMcInnes is building wasm file #752

DanielMcInnes is building wasm file

DanielMcInnes is building wasm file #752

Workflow file for this run

name: build-wasm
run-name: ${{ github.actor }} is building wasm file
on: [push]
jobs:
build-wasm-file:
env:
EMSCRIPTEN: 3.1.25
QT_VERSION: 6.5.2
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update -yq &&
sudo apt-get install -y g++ build-essential mesa-common-dev libssl-dev \
wget lsb libgl1-mesa-dev libxkbcommon-x11-0 libpulse-dev p7zip-full \
ninja-build
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install Qt ${{env.QT_VERSION}} linux desktop
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: "${{env.QT_VERSION}}"
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
modules: 'qtwebsockets qt5compat qtshadertools'
dir: '/opt/hostedtoolcache'
- name: Install QT ${{env.QT_VERSION}} linux wasm and cmake
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: "${{env.QT_VERSION}}"
host: 'linux'
target: 'desktop'
arch: 'wasm_singlethread'
modules: 'qtwebsockets qt5compat qtshadertools'
tools: 'tools_cmake'
dir: '/opt/hostedtoolcache'
- name: patch Qt ${{env.QT_VERSION}}
run: |
echo patch Qt
./.github/patches/qt-fixes.sh
- name: Install emscripten ${{env.EMSCRIPTEN}}
run: |
echo installing emscripten ${EMSCRIPTEN}
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install ${EMSCRIPTEN}
./emsdk activate ${EMSCRIPTEN}
- name: Install QtMQTT
run: |
echo installing QtMQTT
source "/home/runner/work/gui-v2/gui-v2/emsdk/emsdk_env.sh"
git clone https://github.com/qt/qtmqtt.git
cd qtmqtt
git checkout $QT_VERSION
mkdir build-qtmqtt && cd build-qtmqtt
export QTDIR=/opt/hostedtoolcache/Qt/$QT_VERSION/wasm_singlethread
export PATH=$PATH:/opt/hostedtoolcache/Qt/Tools/CMake/bin
${QTDIR}/bin/qt-configure-module ..
cmake --build .
cmake --install . --prefix ${QTDIR} --verbose
- name: Build webassembly GUI
run: |
source "/home/runner/work/gui-v2/gui-v2/emsdk/emsdk_env.sh"
export QTDIR=/opt/hostedtoolcache/Qt/$QT_VERSION/wasm_singlethread
export PATH=$PATH:/opt/hostedtoolcache/Qt/Tools/CMake/bin
mkdir build-wasm && cd build-wasm
${QTDIR}/bin/qt-cmake -DCMAKE_BUILD_TYPE=MinSizeRel ..
cmake --build .
grep -q -E '^var Module=[^;]*;' venus-gui-v2.js
sed -i "s%^\(var Module=[^;]*;\)%\1Module.arguments=['--mqtt','ws://'+document.location.host+':9001/'];%" venus-gui-v2.js
sed -i "s/qtlogo.svg/victronenergy.svg/" venus-gui-v2.html
sed -i "s/background-color: white;/background-color: #4790d0;/" venus-gui-v2.html
sed -i "s/\(, body {\)/\1 background-color: #4790d0;/" venus-gui-v2.html
sed -i "s/ contenteditable=\"true\"//" venus-gui-v2.html
cd -
mkdir -p artifacts/wasm
mv build-wasm/venus-gui-v2.{html,js,wasm} build-wasm/qtloader.js images/victronenergy.svg artifacts/wasm/
mv artifacts/wasm/venus-gui-v2.html artifacts/wasm/index.html
cd artifacts
zip -r ../venus-webassembly.zip wasm
- name: Upload wasm files
uses: actions/upload-artifact@v3
with:
name: venus-webassembly
path: artifacts
retention-days: 5
- name: Release tagged wasm files
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: venus-webassembly.zip