@@ -266,6 +266,41 @@ jobs:
266266 ./build_SITL/*.exe
267267 ./build_SITL/cygwin1.dll
268268
269+ build-SITL-Webassembly :
270+ runs-on : ubuntu-latest
271+ steps :
272+ - uses : actions/checkout@v4
273+ - name : Install dependencies
274+ run : sudo apt-get update && sudo apt-get -y install ninja-build
275+ - name : Setup Emscripten
276+ uses : pyodide/setup-emsdk@v15
277+ - name : Setup environment
278+ env :
279+ ACTIONS_ALLOW_UNSECURE_COMMANDS : true
280+ run : |
281+ # This is the hash of the commit for the PR
282+ # when the action is triggered by PR, empty otherwise
283+ COMMIT_ID=${{ github.event.pull_request.head.sha }}
284+ # This is the hash of the commit when triggered by push
285+ # but the hash of refs/pull/<n>/merge, which is different
286+ # from the hash of the latest commit in the PR, that's
287+ # why we try github.event.pull_request.head.sha first
288+ COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
289+ BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
290+ VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t)]/, "", $2); print $2 }')
291+ echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
292+ echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
293+ echo "NUM_CORES=$(grep processor /proc/cpuinfo | wc -l)" >> $GITHUB_ENV
294+ - name : Build SITL
295+ run : mkdir -p build_WASM && cd build_WASM && cmake -DWASM=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja -j${{ env.NUM_CORES }}
296+ - name : Upload artifacts
297+ uses : actions/upload-artifact@v4
298+ with :
299+ name : ${{ env.BUILD_NAME }}_WASM
300+ path : |
301+ ./build_WASM/*_WASM.*
302+ ./build_WASM/*.html
303+
269304 test :
270305 # needs: [build]
271306 runs-on : ubuntu-latest
0 commit comments