Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: agracio/electron-edge-js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v31.3.0
Choose a base ref
...
head repository: agracio/electron-edge-js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 3,129 additions and 656 deletions.
  1. +14 −0 .github/FUNDING.yml
  2. +65 −0 .github/actions/build-electron/action.yml
  3. +34 −0 .github/actions/build/action.yml
  4. +59 −0 .github/actions/create-test-report/action.yml
  5. +25 −0 .github/actions/get-electron-version/action.yml
  6. +93 −0 .github/actions/setup-env/action.yml
  7. +62 −0 .github/actions/test-build/action.yml
  8. +32 −0 .github/actions/test-windows/action.yml
  9. +300 −0 .github/workflows/build-all.yml
  10. +127 −0 .github/workflows/build.yml
  11. +207 −0 .github/workflows/main.yml
  12. +5 −1 .gitignore
  13. +7 −1 .npmignore
  14. +56 −28 README.md
  15. BIN lib/native/win32/arm64/29.0.0/edge_coreclr.node
  16. BIN lib/native/win32/arm64/29.0.0/edge_nativeclr.node
  17. BIN lib/native/win32/arm64/30.0.0/edge_coreclr.node
  18. BIN lib/native/win32/arm64/30.0.0/edge_nativeclr.node
  19. BIN lib/native/win32/arm64/31.0.0/edge_coreclr.node
  20. BIN lib/native/win32/arm64/31.0.0/edge_nativeclr.node
  21. BIN lib/native/win32/arm64/32.0.0/edge_coreclr.node
  22. BIN lib/native/win32/arm64/32.0.0/edge_nativeclr.node
  23. BIN lib/native/win32/arm64/33.0.0/edge_coreclr.node
  24. BIN lib/native/win32/arm64/33.0.0/edge_nativeclr.node
  25. BIN lib/native/win32/arm64/34.0.0/edge_coreclr.node
  26. BIN lib/native/win32/arm64/34.0.0/edge_nativeclr.node
  27. BIN lib/native/win32/ia32/23.0.0/edge_coreclr.node
  28. BIN lib/native/win32/ia32/23.0.0/edge_nativeclr.node
  29. BIN lib/native/win32/ia32/24.0.0/edge_coreclr.node
  30. BIN lib/native/win32/ia32/24.0.0/edge_nativeclr.node
  31. BIN lib/native/win32/ia32/25.0.0/edge_coreclr.node
  32. BIN lib/native/win32/ia32/25.0.0/edge_nativeclr.node
  33. BIN lib/native/win32/ia32/26.0.0/edge_coreclr.node
  34. BIN lib/native/win32/ia32/26.0.0/edge_nativeclr.node
  35. BIN lib/native/win32/ia32/27.0.0/edge_coreclr.node
  36. BIN lib/native/win32/ia32/27.0.0/edge_nativeclr.node
  37. BIN lib/native/win32/ia32/28.0.0/edge_coreclr.node
  38. BIN lib/native/win32/ia32/28.0.0/edge_nativeclr.node
  39. BIN lib/native/win32/ia32/29.0.0/edge_coreclr.node
  40. BIN lib/native/win32/ia32/29.0.0/edge_nativeclr.node
  41. BIN lib/native/win32/ia32/30.0.0/edge_coreclr.node
  42. BIN lib/native/win32/ia32/30.0.0/edge_nativeclr.node
  43. BIN lib/native/win32/ia32/31.0.0/edge_coreclr.node
  44. BIN lib/native/win32/ia32/31.0.0/edge_nativeclr.node
  45. BIN lib/native/win32/ia32/32.0.0/edge_coreclr.node
  46. BIN lib/native/win32/ia32/32.0.0/edge_nativeclr.node
  47. BIN lib/native/win32/ia32/33.0.0/edge_coreclr.node
  48. BIN lib/native/win32/ia32/33.0.0/edge_nativeclr.node
  49. BIN lib/native/win32/ia32/34.0.0/edge_coreclr.node
  50. BIN lib/native/win32/ia32/34.0.0/edge_nativeclr.node
  51. BIN lib/native/win32/x64/23.0.0/edge_coreclr.node
  52. BIN lib/native/win32/x64/23.0.0/edge_nativeclr.node
  53. BIN lib/native/win32/x64/24.0.0/edge_coreclr.node
  54. BIN lib/native/win32/x64/24.0.0/edge_nativeclr.node
  55. BIN lib/native/win32/x64/25.0.0/edge_coreclr.node
  56. BIN lib/native/win32/x64/25.0.0/edge_nativeclr.node
  57. BIN lib/native/win32/x64/26.0.0/edge_coreclr.node
  58. BIN lib/native/win32/x64/26.0.0/edge_nativeclr.node
  59. BIN lib/native/win32/x64/27.0.0/edge_coreclr.node
  60. BIN lib/native/win32/x64/27.0.0/edge_nativeclr.node
  61. BIN lib/native/win32/x64/28.0.0/edge_coreclr.node
  62. BIN lib/native/win32/x64/28.0.0/edge_nativeclr.node
  63. BIN lib/native/win32/x64/29.0.0/edge_coreclr.node
  64. BIN lib/native/win32/x64/29.0.0/edge_nativeclr.node
  65. BIN lib/native/win32/x64/30.0.0/edge_coreclr.node
  66. BIN lib/native/win32/x64/30.0.0/edge_nativeclr.node
  67. BIN lib/native/win32/x64/31.0.0/edge_coreclr.node
  68. BIN lib/native/win32/x64/31.0.0/edge_nativeclr.node
  69. BIN lib/native/win32/x64/32.0.0/edge_coreclr.node
  70. BIN lib/native/win32/x64/32.0.0/edge_nativeclr.node
  71. BIN lib/native/win32/x64/33.0.0/edge_coreclr.node
  72. BIN lib/native/win32/x64/33.0.0/edge_nativeclr.node
  73. BIN lib/native/win32/x64/34.0.0/edge_coreclr.node
  74. BIN lib/native/win32/x64/34.0.0/edge_nativeclr.node
  75. +1,239 −185 package-lock.json
  76. +9 −6 package.json
  77. +91 −24 src/CoreCLREmbedding/coreclrembedding.cpp
  78. +3 −3 src/CoreCLREmbedding/deps/deps_format.cpp
  79. +34 −7 src/CoreCLREmbedding/host/runtime_config.cpp
  80. +3 −1 src/CoreCLREmbedding/json/casablanca/include/stdafx.h
  81. +2 −0 src/CoreCLREmbedding/pal/pal.h
  82. +1 −1 src/dotnet/clrfunc.cpp
  83. +1 −1 src/dotnet/nodejsfuncinvokecontext.cpp
  84. +1 −1 src/double/Edge.js/Edge.js.csproj
  85. +56 −14 src/double/Edge.js/dotnet/EdgeJs.cs
  86. +187 −227 src/double/Edge.js/dotnetcore/coreclrembedding.cs
  87. +30 −7 test/102_node2net.js
  88. +29 −1 test/103_net2node.js
  89. +24 −1 test/105_node2net_sync.js
  90. +115 −0 test/106_node2net_symbols.js
  91. +11 −9 test/app.js
  92. +1 −1 test/index.html
  93. BIN test/loading.gif
  94. +2 −1 test/test.csproj
  95. +48 −23 test/tests.cs
  96. +24 −58 tools/build.bat
  97. +0 −36 tools/download.js
  98. +65 −0 tools/getVersion.js
  99. +20 −17 tools/install.js
  100. +28 −0 tools/mergeTests.js
  101. +19 −2 tools/test.js
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

github: [agracio]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
65 changes: 65 additions & 0 deletions .github/actions/build-electron/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 'Electron build'
description: 'Electron build'
inputs:
electron:
description: 'Electron version'
required: true
os:
description: 'runs-on'
required: false
default: 'windows-2022'

runs:
using: "composite"
steps:

- name: Setup env
uses: ./.github/actions/setup-env
with:
electron: '${{ inputs.electron }}.0.0'
os: ${{ inputs.os }}

- name: install node-gyp
shell: bash
run: npm i -g node-gyp

- name: Create release folder
shell: cmd
run: |
mkdir "release\ia32\${{ inputs.electron }}.0.0"
mkdir "release\x64\${{ inputs.electron }}.0.0"
mkdir "release\arm64\${{ inputs.electron }}.0.0"
- name: Cache node-gyp
uses: actions/cache@v4
env:
cache-name: cache-node-gyp
with:
path: ~\AppData\Local\node-gyp\Cache
key: '${{ inputs.electron }}.0.0'

- name: Build ia32
uses: ./.github/actions/build
with:
electron: ${{ inputs.electron }}
arch: 'ia32'

- name: Build x64
uses: ./.github/actions/build
with:
electron: ${{ inputs.electron }}
arch: 'x64'

- name: Build arm64
uses: ./.github/actions/build
with:
electron: ${{ inputs.electron }}
arch: 'arm64'

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: electron-edge-js-${{ inputs.electron }}.0.0
path: |
release
34 changes: 34 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Build Windows binaries'
description: 'Build Windows binaries'
inputs:
electron:
description: 'Electron version'
required: true
arch:
description: 'Target arch'
required: true

runs:
using: "composite"
steps:

- name: Build ${{ inputs.arch }}
shell: pwsh
run: |
node-gyp configure --target=${{ inputs.electron }}.0.0 --disturl=https://electronjs.org/headers --runtime=electron --release --arch=${{ inputs.arch }}
if ( '${{ inputs.arch }}' -eq 'arm64'){
(Get-Content -Raw build/build_managed.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/build_managed.vcxproj
(Get-Content -Raw build/edge_coreclr.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/edge_coreclr.vcxproj
(Get-Content -Raw build/edge_nativeclr.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/edge_nativeclr.vcxproj
}
if ( '${{ inputs.electron }}' -eq 32){
(Get-Content -Raw build/build_managed.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/build_managed.vcxproj
(Get-Content -Raw build/edge_coreclr.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/edge_coreclr.vcxproj
(Get-Content -Raw build/edge_nativeclr.vcxproj) -replace 'std:c\+\+17', 'std:c++20' | Out-File -Encoding Utf8 build/edge_nativeclr.vcxproj
}
node-gyp build
cmd /c copy /y build\Release\edge_*.node release\${{ inputs.arch }}\${{ inputs.electron }}.0.0
cmd /c rmdir /S /Q build
59 changes: 59 additions & 0 deletions .github/actions/create-test-report/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 'Test report'
description: 'Create test report'
inputs:
name:
description: 'name'
required: false
default: 'test-results'
electron:
description: 'Electron version'
required: true
os:
description: 'runs-on'
required: true

runs:
using: "composite"
steps:
- name: "Merge test files"
shell: bash
run: node tools/mergeTests.js ${{ inputs.electron }}

- name: Read mochawesome.json
uses: actions/github-script@v7
with:
result-encoding: string
script: |
try {
const fs = require('fs')
const jsonString = fs.readFileSync('test/mochawesome-report/mochawesome.json')
var report = JSON.parse(jsonString);
let stats = {
Passing: report.stats.passes,
Skipped: report.stats.pending,
Failures: report.stats.failures
};
core.notice(stats);
} catch(err) {
core.error("Error while reading or parsing test/mochawesome-report/mochawesome.json")
core.setFailed(err)
}
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: ${{ inputs.name }}-${{ inputs.os }}-${{ inputs.electron }}
path: |
test/mochawesome-report/mochawesome.json
test/mochawesome-report/mochawesome.html
test/mochawesome-report/assets/
# - name: Create test report
# uses: phoenix-actions/test-reporting@v15
# if: success()
# with:
# name: ${{ inputs.name }}-${{ inputs.os }}-v${{ inputs.electron }}
# fail-on-error: true
# path: test/mochawesome-report/mochawesome.json # Path to test results
# reporter: mochawesome-json
25 changes: 25 additions & 0 deletions .github/actions/get-electron-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Get Electron version'
description: 'Get Electron version'
inputs:
electron:
description: 'Electron version'
required: true

runs:
using: "composite"
steps:

- name: Resolve Electron version from major
shell: bash
run: |
if [[ ${{ inputs.electron }} == '29' ]]; then
echo "test-version=29.4.6" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.electron }} == '30' ]]; then
echo "test-version=30.5.1" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.electron }} == '31' ]]; then
echo "test-version=31.7.2" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.electron }} == '32' ]]; then
echo "test-version=32.2.2" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.electron }} == '33' ]]; then
echo "test-version=33.0.2" >> $GITHUB_OUTPUT
fi
93 changes: 93 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: 'Setup environment'
description: 'Sets up environment'
inputs:
node:
description: 'Node.js version'
required: false
default: '22'
os:
description: 'runs-on'
required: false
default: 'windows-2022'
electron:
description: 'Electron version'
required: true
replace-version:
description: 'Replace electron version?'
required: false
default: 'false'

runs:
using: "composite"
steps:

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node }}
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Read package.json
uses: actions/github-script@v7
with:
result-encoding: string
script: |
try {
const fs = require('fs')
const jsonString = fs.readFileSync('package.json')
var json = JSON.parse(jsonString);
core.exportVariable('json_electron_version', json.devDependencies.electron.toString())
} catch(err) {
core.error("Error while reading or parsing package.json")
core.setFailed(err)
}
- name: setup electron version
shell: bash
if: ${{ inputs.replace-version == 'true' }}
run: |
sed -i -e 's/\${{ env.json_electron_version}}/=${{ inputs.electron }}/g' package.json
- name: Cache node-gyp Linux
if: runner.os == 'Linux'
uses: actions/cache@v4
env:
cache-name: cache-node-gyp
with:
path: ~/.cache/node-gyp
key: '${{ inputs.os }}-${{ inputs.electron}}'

- name: Cache node-gyp macOs
if: runner.os == 'macOS'
uses: actions/cache@v4
env:
cache-name: cache-node-gyp
with:
path: ~/Library/Caches/node-gyp
key: '${{ inputs.os }}-${{ inputs.electron}}'

- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ inputs.os }}-${{ inputs.electron }}-${{ hashFiles('package.json') }}

- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # SDK Version to use; x will use the latest version of the 8.0 channel

- name: Versions
shell: bash
run: |
node -v && npm -v && dotnet --version && node -p process.platform && node -p process.arch
- name: npm install
shell: bash
run: npm i
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
62 changes: 62 additions & 0 deletions .github/actions/test-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 'Test built Windows binary'
description: 'Test built Windows binary'
inputs:
os:
description: 'runs-on'
required: false
default: 'windows-2022'
electron:
description: 'Electron version'
required: true

runs:
using: "composite"
steps:

- name: Setup env
uses: ./.github/actions/setup-env
with:
electron: ${{ inputs.electron }}
os: ${{ inputs.os }}
replace-version: true

- uses: agracio/github-substring-action@v1.0.0
id: electron_version
with:
value: ${{ inputs.electron }}
length_from_start: 2

- name: Create release folder
shell: pwsh
run: |
cmd /c if not exist "lib\native\win32\ia32\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\ia32\${{ steps.electron_version.outputs.substring }}.0.0"
cmd /c if not exist "lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0"
cmd /c if not exist "lib\native\win32\arm64\${{ steps.electron_version.outputs.substring }}.0.0" mkdir "lib\native\win32\arm64\${{ steps.electron_version.outputs.substring }}.0.0"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: electron-edge-js-${{ steps.electron_version.outputs.substring }}.0.0*

- name: List artifacts
shell: bash
run: ls -R release

- name: Copy artifacts
shell: pwsh
run: |
cmd /c copy /y release\electron-edge-js-${{ steps.electron_version.outputs.substring }}.0.0\x64\${{ steps.electron_version.outputs.substring }}.0.0\edge_*.node lib\native\win32\x64\${{ steps.electron_version.outputs.substring }}.0.0
- name: Test
uses: ./.github/actions/test-windows
with:
electron: ${{ inputs.electron }}

- name: Test report
uses: ./.github/actions/create-test-report
with:
electron: ${{ inputs.electron }}
os: ${{ inputs.os }}
name: 'build-tests'

32 changes: 32 additions & 0 deletions .github/actions/test-windows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Test Windows'
description: 'Runs Windows tests'
inputs:
electron:
description: 'Electron version'
required: true

runs:
using: "composite"
steps:
- uses: agracio/github-substring-action@v1.0.0
id: electron_version
with:
value: "${{ inputs.electron }}"
length_from_start: 2

- name: Check electron-edge-js Windows pre-built files
uses: andstor/file-existence-action@v3
with:
files: "lib/native/win32/${{ runner.arch }}/${{ steps.electron_version.outputs.substring }}.0.0/edge_coreclr.node, lib/native/win32/${{ runner.arch }}/${{ steps.electron_version.outputs.substring }}.0.0/edge_nativeclr.node"
fail: true
ignore_case: true

- name: Run .NET 4.5 tests Windows
shell: bash
run: node tools/test.js CI

- name: "Run .net core tests Windows"
shell: bash
run: node tools/test.js CI
env:
EDGE_USE_CORECLR: 1
Loading