The page allowed any script. It now sets a policy: scripts only from its own origin, plus WebAssembly; images from its own origin, data: and blob:, which the app creates; nothing from elsewhere. The inline script moved to shell.js, copied beside the page like keylog.js, and the canvas's inline context-menu handler went with it. Checked in headless Edge: showcase, notepad and simple start and draw the same pixels with the policy as without, the showcase's accessibility tree is the same, and the console shows no violation, with ?keylog too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
128 lines
4.5 KiB
YAML
128 lines
4.5 KiB
YAML
name: Web
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
type: string
|
|
default: ''
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: web-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
web:
|
|
name: web
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
env:
|
|
EMSCRIPTEN_VERSION: 6.0.9
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
submodules: recursive
|
|
persist-credentials: false
|
|
|
|
- name: Restore emsdk
|
|
id: emsdk
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ~/emsdk
|
|
key: emsdk-${{ env.EMSCRIPTEN_VERSION }}-tag
|
|
|
|
# ccache only: the build folder is rebuilt, so a stale cache cannot hide a broken one.
|
|
- name: Restore the compiler cache
|
|
id: ccache
|
|
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: .ccache
|
|
key: ccache-web-${{ env.EMSCRIPTEN_VERSION }}-${{ github.run_id }}
|
|
restore-keys: ccache-web-${{ env.EMSCRIPTEN_VERSION }}-
|
|
|
|
- name: Install emsdk
|
|
run: |
|
|
if [ ! -d "$HOME/emsdk" ]; then
|
|
git clone --depth 1 --branch "$EMSCRIPTEN_VERSION" https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
|
|
"$HOME/emsdk/emsdk" install "$EMSCRIPTEN_VERSION"
|
|
fi
|
|
"$HOME/emsdk/emsdk" activate "$EMSCRIPTEN_VERSION"
|
|
sudo apt-get update && sudo apt-get install -y ninja-build ccache
|
|
|
|
- name: Save emsdk
|
|
if: ${{ steps.emsdk.outputs.cache-hit != 'true' }}
|
|
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ~/emsdk
|
|
key: emsdk-${{ env.EMSCRIPTEN_VERSION }}-tag
|
|
|
|
- name: Build
|
|
id: build
|
|
run: |
|
|
export CCACHE_DIR=$PWD/.ccache CCACHE_BASEDIR=$PWD CCACHE_MAXSIZE=500M
|
|
ccache -z
|
|
EMSDK="$HOME/emsdk" ./build-wasm.sh -- -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
|
|
ccache -s
|
|
|
|
- name: Save the compiler cache
|
|
if: ${{ always() && steps.build.outcome == 'success' }}
|
|
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: .ccache
|
|
key: ${{ steps.ccache.outputs.cache-primary-key }}
|
|
|
|
- name: Package
|
|
run: |
|
|
version='${{ inputs.version || 'dev' }}'
|
|
name="reaktor-${version}-web"
|
|
mkdir -p "dist/$name/licenses"
|
|
for p in showcase notepad simple; do
|
|
cp "build-wasm/$p.html" "build-wasm/$p.js" "build-wasm/$p.wasm" \
|
|
"build-wasm/$p.data" "dist/$name/"
|
|
done
|
|
cp build-wasm/shell.js build-wasm/keylog.js build-wasm/reaktor-icon.svg build-wasm/reaktor-icon.png \
|
|
"dist/$name/"
|
|
cp build-wasm/licenses/*.txt "dist/$name/licenses/"
|
|
cp external/simplecss/LICENSE "dist/$name/licenses/simplecss.txt"
|
|
cp assets/fonts/Aileron-Notice.txt assets/fonts/MPLUS1p-Notice.txt \
|
|
"dist/$name/licenses/"
|
|
cp docs/NOTICE.md "dist/$name/"
|
|
(cd dist && zip -qr "$name.zip" "$name")
|
|
|
|
- name: Upload the package
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: package-web
|
|
path: dist/reaktor-*.zip
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
|
|
- name: Check and pack libreaktor
|
|
run: |
|
|
version='${{ inputs.version || 'dev' }}'
|
|
name="libreaktor-${version}-wasm"
|
|
cmake --build build-wasm --target libreaktor
|
|
cmake --install build-wasm --prefix "dist/$name" --component libreaktor
|
|
cmake -S examples/consumer -B build-consumer -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
|
"-DCMAKE_TOOLCHAIN_FILE=$HOME/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
|
|
"-Dreaktor_DIR=$PWD/dist/$name/lib/cmake/reaktor"
|
|
cmake --build build-consumer
|
|
test -s build-consumer/simple.wasm
|
|
tar -C dist -czf "dist/$name.tar.gz" "$name"
|
|
|
|
- name: Upload libreaktor
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: package-libreaktor-wasm
|
|
path: dist/libreaktor-*.tar.gz
|
|
if-no-files-found: error
|
|
retention-days: 14
|