name: build-hermesc-windows description: This action builds hermesc for Windows platforms inputs: hermes-version: required: True description: The version of Hermes react-native-version: required: True description: The version of React Native runs: using: composite steps: - name: Download Previous Artifacts uses: actions/download-artifact@v4 with: name: hermes-workspace path: 'C:\tmp\hermes' - name: Set up workspace shell: powershell run: | mkdir -p C:\tmp\hermes\osx-bin mkdir -p .\packages\react-native\sdks\hermes cp -r -Force C:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\. cp -r -Force .\packages\react-native\sdks\hermes-engine\utils\* .\packages\react-native\sdks\hermes\. - name: Windows cache uses: actions/cache@v4 with: key: v3-hermes-${{ github.job }}-windows-${{ inputs.hermes-version }}-${{ inputs.react-native-version }} path: | C:\tmp\hermes\win64-bin\ C:\tmp\hermes\hermes\icu\ C:\tmp\hermes\hermes\deps\ C:\tmp\hermes\hermes\build_release\ - name: setup-msbuild uses: microsoft/setup-msbuild@v1.3.2 - name: Set up workspace shell: powershell run: | New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\icu New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\deps New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\win64-bin - name: Downgrade CMake shell: powershell run: choco install cmake --version 3.31.6 --force - name: Build HermesC for Windows shell: powershell run: | if (-not(Test-Path -Path $Env:HERMES_WS_DIR\win64-bin\hermesc.exe)) { cd $Env:HERMES_WS_DIR\icu # If Invoke-WebRequest shows a progress bar, it will fail with # Win32 internal error "Access is denied" 0x5 occurred [...] $progressPreference = 'silentlyContinue' Invoke-WebRequest -Uri "$Env:ICU_URL" -OutFile "icu.zip" Expand-Archive -Path "icu.zip" -DestinationPath "." cd $Env:HERMES_WS_DIR Copy-Item -Path "icu\bin64\icu*.dll" -Destination "deps" # Include MSVC++ 2015 redistributables Copy-Item -Path "c:\windows\system32\msvcp140.dll" -Destination "deps" Copy-Item -Path "c:\windows\system32\vcruntime140.dll" -Destination "deps" Copy-Item -Path "c:\windows\system32\vcruntime140_1.dll" -Destination "deps" $Env:PATH += ";$Env:CMAKE_DIR;$Env:MSBUILD_DIR" $Env:ICU_ROOT = "$Env:HERMES_WS_DIR\icu" cmake -S hermes -B build_release -G 'Visual Studio 17 2022' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF if (-not $?) { throw "Failed to configure Hermes" } echo "Running windows build..." cd build_release cmake --build . --target hermesc --config Release if (-not $?) { throw "Failed to build Hermes" } echo "Copying hermesc.exe to win64-bin" cd $Env:HERMES_WS_DIR Copy-Item -Path "build_release\bin\Release\hermesc.exe" -Destination "win64-bin" # Include Windows runtime dependencies Copy-Item -Path "deps\*" -Destination "win64-bin" } else { Write-Host "Skipping; Clean c:\tmp\hermes\win64-bin to rebuild." } - name: Upload windows artifacts uses: actions/upload-artifact@v4.3.4 with: name: hermes-win64-bin path: C:\tmp\hermes\win64-bin\