Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/bin/pip-install-requirements.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
./emsdk.ps1 activate tot
Set-Location emscripten
Invoke-Expression "$env:EMSDK_PYTHON -m pip install --upgrade pip"
Invoke-Expression "$env:EMSDK_PYTHON -m pip install -r requirements-dev.txt"
3 changes: 3 additions & 0 deletions .github/bin/run-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
./emsdk.ps1 activate tot
Set-Location emscripten
Invoke-Expression "$env:EMSDK_PYTHON .\test\runner.py ${args[0]} --failfast"
279 changes: 275 additions & 4 deletions .github/workflows/build-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,291 @@ name: Build emsdk dependencies
on:
workflow_dispatch:
inputs:
branch:
description: 'LLVM Webassembly arm64'
llvm_build:
description: 'LLVM WebAssembly Arm64'
required: false
default: false
type: boolean
llvm_build_cross_compilation:
description: 'LLVM WebAssembly Arm64 (cross compilation)'
required: false
default: false
type: boolean
python_build:
description: 'Python Arm64'
required: false
default: false
type: boolean
binaryen_build:
description: 'Binaryen Arm64'
required: false
default: false
type: boolean
emscripten_build:
description: 'Emscripten Arm64'
required: false
default: false
type: boolean
nodejs_build:
description: 'Node.js Arm64'
required: false
default: false
type: boolean
wasm_binaries_build:
description: 'WASM binaries Arm64'
required: false
default: false
type: boolean

jobs:
build-llvm-webassembly-arm64:
if: ${{ inputs.llvm_build || inputs.wasm_binaries_build }}

runs-on: [self-hosted, Windows, ARM64, WASM]
timeout-minutes: 600

steps:

- name: Build LLVM WebAssembly for Arm64
shell: cmd
run: |
git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git --single-branch --depth 1
cd llvm-project
if exist build_arm64 rmdir /s /q build_arm64
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" arm64
cmake -G Ninja -S llvm -B build_arm64 ^
-DCLANG_ENABLE_ARCMT=OFF ^
-DCLANG_ENABLE_STATIC_ANALYZER=OFF ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON ^
-DCMAKE_CXX_COMPILER_LAUNCHER='ccache' ^
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON ^
-DCMAKE_LINKER="C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\Llvm\x64\bin\lld-link.exe" ^
-DLLVM_BUILD_LLVM_DYLIB=OFF ^
-DLLVM_LINK_LLVM_DYLIB=OFF ^
-DLLVM_DISTRIBUTION_COMPONENTS='clang;lld;llvm-ar;llvm-addr2line;llvm-cxxfilt;llvm-dwarfdump;llvm-dwp;llvm-nm;llvm-objcopy;llvm-objdump;llvm-ranlib;llvm-readobj;llvm-size;llvm-strings;llvm-strip;llvm-symbolizer;clang-resource-headers' ^
-DLLVM_ENABLE_ASSERTIONS=OFF ^
-DLLVM_ENABLE_BINDINGS=OFF ^
-DLLVM_ENABLE_LIBXML2=OFF ^
-DLLVM_ENABLE_PROJECTS='lld;clang' ^
-DLLVM_ENABLE_TERMINFO=ON ^
-DLLVM_INCLUDE_EXAMPLES=OFF ^
-DLLVM_INCLUDE_TESTS=OFF ^
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^
-DLLVM_TARGETS_TO_BUILD='host;WebAssembly' ^
-DLLVM_TOOL_LTO_BUILD=OFF ^
-DLLVM_TOOLCHAIN_TOOLS='clang;lld;llvm-ar;llvm-addr2line;llvm-cxxfilt;llvm-dwarfdump;llvm-dwp;llvm-nm;llvm-objcopy;llvm-objdump;llvm-ranlib;llvm-readobj;llvm-size;llvm-strings;llvm-strip;llvm-symbolizer;clang-resource-headers' ^
-DLLVM_USE_CRT_RELEASE=MT ^
-DLLVM_USE_CRT_DEBUG=MTd
cd build_arm64
ninja -v install-distribution

- name: Pack llvm-arm64.zip
run: |
cd llvm-project/build_arm64
$unneeded_tool = 'clang-check', 'clang-cl', 'clang-cpp',
'clang-extdef-mapping', 'clang-format',
'clang-func-mapping', 'clang-import-test',
'clang-linker-wrapper', 'clang-offload-bundler',
'clang-offload-packager', 'clang-refactor',
'clang-rename', 'clang-repl', 'clang-scan-deps',
'diagtool', 'git-clang-format', 'hmaptool', 'ld.lld',
'ld64.lld', 'ld64.lld.darwinnew', 'ld64.lld.darwinold',
'lld-link', 'libclang.dll', 'llvm-cov', 'llvm-ml',
'llvm-lib', 'llvm-pdbutil', 'llvm-profdata',
'llvm-rc'
foreach ($tool in $unneeded_tool) {
$tool = "bin" + $tool + ".exe"
if (Test-Path $tool) {
"Remove " + $tool
Remove-Item $tool
}
}
Compress-Archive -Path bin,lib\clang -DestinationPath llvm-arm64

- name: Archive llvm-arm64.zip
uses: actions/upload-artifact@v3
with:
name: llvm-arm64
path: llvm-project/build_arm64/llvm-arm64.zip
retention-days: 1

build-llvm-webassembly-arm64_cross_compilation:
if: ${{ inputs.llvm_build_llvm_build_cross_compilation }}

runs-on: windows-latest

steps:

- name: Build LLVM WebAssembly arm64
- name: Build LLVM WebAssembly for Arm64 (Cross Compilation)
run: |
Set-PSDebug -Trace 1
git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git --single-branch --branch main --depth 1
cd llvm-project
cmake -S llvm -B build_host -DLLVM_ENABLE_PROJECTS='lld;clang' -DLLVM_TARGETS_TO_BUILD=""
cmake --build build_host --target llvm-tblgen llvm-nm clang-tblgen --config MinSizeRel
$llvm_root = Get-Location
cmake -S llvm -B build_arm64 -A ARM64 `
-DLLVM_TABLEGEN="$llvm_root\build_host\MinSizeRel\bin\llvm-tblgen.exe" `
-DCLANG_TABLEGEN="$llvm_root\build_host\MinSizeRel\bin\clang-tblgen.exe" `
-DLLVM_NM="$llvm_root\build_host\MinSizeRel\bin\llvm-nm.exe" `
-DLLVM_ENABLE_PROJECTS='lld;clang' -DLLVM_TARGETS_TO_BUILD="host;WebAssembly" `
-DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF
cmake --build build_arm64 --config MinSizeRel

build-python:
if: ${{ inputs.python_build }}

runs-on: [self-hosted, Windows, ARM64, WASM]

steps:
- name: Git checkout
uses: actions/checkout@v3
with:
path: emsdk

- name: Build Emscripten Python package for Arm64
working-directory: emsdk
shell: cmd
run: python scripts\update_python.py

- name: Archive python-3.9.2-arm64-4+pywin32.zip
uses: actions/upload-artifact@v3
with:
name: python-3.9.10-arm64-4+pywin32
path: emsdk/python-3.9.10-arm64-4+pywin32.zip
retention-days: 3

build-binaryen:
if: ${{ inputs.binaryen_build || inputs.wasm_binaries_build}}

runs-on: [self-hosted, Windows, ARM64, WASM]

steps:
- name: Build Binaryen for Arm64
shell: cmd
run: |
git clone https://github.com/WebAssembly/binaryen.git --single-branch --depth 1
cd binaryen
git submodule init
git submodule update
if exist bin rmdir /s /q bin
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" arm64
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER='ccache' .
ninja


- name: Archive binaryen-arm64.zip
uses: actions/upload-artifact@v3
with:
name: binaryen-arm64
path: binaryen/binaryen-arm64.zip
retention-days: 1

build-nodejs:
if: ${{ inputs.nodejs_build }}

runs-on: [self-hosted, Windows, ARM64, WASM]

steps:

- name: Add 7-Zip to PATH
run: |
echo "PATH=$env:PATH;C:\Program Files\7-Zip" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Check 7-Zip installed
run: |
7z

- name: Build Node.js for Arm64
run: |
git clone https://github.com/Windows-on-ARM-Experiments/node.git --single-branch -b fix-arm64-compilation --depth 1
cd node
.\vcbuild.bat arm64 package

- name: Prepare Node.js package
run: |
cd .\node\out\Release
Remove-Item -Path .\tmp -Recurse -Force -ErrorAction Ignore
New-Item -ItemType Directory -Force -Path .\tmp\node-v20.0.0-win-arm64\bin
cp .\node-v20.0.0-win-arm64\* .\tmp\node-v20.0.0-win-arm64\bin
ls .\tmp\node-v20.0.0-win-arm64\bin
ls .\tmp\node-v20.0.0-win-arm64\bin\node_modules
Compress-Archive -Path .\tmp\node-v20.0.0-win-arm64 -DestinationPath node-v20.0.0-win-arm64-2.zip

- name: Archive node-v20.0.0-win-arm64.zip
uses: actions/upload-artifact@v3
with:
name: node-v20.0.0-win-arm64
path: node/out/Release/tmp/*

- name: Archive node-v20.0.0-win-arm64-2.zip
uses: actions/upload-artifact@v3
with:
name: node-v20.0.0-win-arm64-2
path: node/out/Release/node-v20.0.0-win-arm64-2.zip

- name: Cleanup
run: |
Remove-Item -Path .\node\out\Release\tmp -Recurse -Force -ErrorAction Ignore

build-emscripten:
if: ${{ inputs.emscripten_build || inputs.wasm_binaries_build }}

runs-on: [ubuntu-latest]

steps:

- name: Build Emscripten
run: |
git clone https://github.com/emscripten-core/emscripten.git --single-branch --depth 1
cd emscripten
./tools/install.py ../emscripten_package
npm ci --production --no-optional ../emscripten_package
cd ../emscripten_package
zip -r ../emscripten-package.zip .

- name: Archive emscripten-package.zip
uses: actions/upload-artifact@v3
with:
name: emscripten-package
path: emscripten-package.zip
retention-days: 1

build-wasm-binaries:
if: ${{ inputs.wasm_binaries_build }}
needs: [build-emscripten, build-binaryen, build-llvm-webassembly-arm64]

runs-on: [windows-latest]

steps:

- uses: actions/download-artifact@v3
with:
name: emscripten-package

- uses: actions/download-artifact@v3
with:
name: llvm-arm64

- uses: actions/download-artifact@v3
with:
name: binaryen-arm64

- name: Pack wasm-binaries for Arm64
run: |
set
ls
New-Item -ItemType Directory -Force -Path emsdk/emscripten
Expand-Archive -LiteralPath emscripten-package.zip -DestinationPath emsdk\emscripten
Expand-Archive -LiteralPath llvm-arm64.zip -DestinationPath emsdk
Expand-Archive -LiteralPath binaryen-arm64.zip -DestinationPath emsdk
cd emsdk
Compress-Archive -Path * -DestinationPath wasm-binaries-arm64

- name: Archive wasm-binaries-arm64.zip
uses: actions/upload-artifact@v3
with:
name: wasm-binaries-arm64
path: emsdk/wasm-binaries-arm64.zip
retention-days: 3

71 changes: 71 additions & 0 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Test the release package

on:
workflow_dispatch:
inputs:
emscripten_repository:
description: 'Emscripten repository'
required: true
default: 'Windows-on-ARM-Experiments/emscripten'
type: string
emscripten_branch:
description: 'Emscripten repository branch'
required: true
default: 'fix-unit-tests-arm64'
type: string
emscripten_test_suite:
description: 'Emscripten test suite'
required: true
default: 'test_hello_world'
type: string

defaults:
run:
working-directory: test-package

jobs:
test-binary-package:
runs-on: windows-latest
timeout-minutes: 240

steps:
- name: Create working directory
working-directory: ${{ github.workspace }}
run: New-Item -ItemType Directory -Force -Path test-package

- name: Git checkout
uses: actions/checkout@v3
with:
path: test-package

- name: List Emscripten packages
run: .\emsdk.ps1 list

- name: Install latest release package
run: .\emsdk.ps1 install tot

- name: Activate latest release package
run: .\emsdk.ps1 activate tot

- name: List Emscripten packages
run: .\emsdk.ps1 list

- name: Git checkout Emscripten
uses: actions/checkout@v3
with:
repository: ${{ inputs.emscripten_repository }}
ref: ${{ inputs.emscripten_branch }}
path: test-package/emscripten
submodules: 'recursive'

- name: Install Node packages
working-directory: test-package/emscripten
run: npm ci

- name: Install Python packages to emsdk Python
run: ${{ github.workspace }}\test-package\.github\bin\pip-install-requirements.ps1

- name: Run unit tests with emsdk Python
run: ${{ github.workspace }}\test-package\.github\bin\run-tests.ps1 ${{ inputs.emscripten_test_suite }}
env:
EMCC_DEBUG: 1 # Disables parallel tests execution which leads to race conditions.
2 changes: 1 addition & 1 deletion emsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ def emscripten_npm_install(tool, directory):
closure_compiler_native = 'google-closure-compiler-linux'
if MACOS and ARCH in ('x86', 'x86_64'):
closure_compiler_native = 'google-closure-compiler-osx'
if WINDOWS and ARCH in ('x86_64', 'aarch64'):
if WINDOWS and ARCH in ('x86_64'):
closure_compiler_native = 'google-closure-compiler-windows'

if closure_compiler_native:
Expand Down
Loading