Skip to content

Commit

Permalink
testing macOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
agracio committed Mar 6, 2025
1 parent 1798a13 commit bf6bd10
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .github/actions/build-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ runs:
script: |
try {
const fs = require('fs')
if('${{ inputs.os }}' == 'windows-2022'){
if(${{ runner.os }} == 'Windows'){
if(${{ inputs.node }} <23){
fs.writeFileSync('release/ia32/${{ inputs.node }}/node.version', '${{ steps.node-test-version.outputs.node-version }}');
}
Expand All @@ -72,7 +72,7 @@ runs:
fs.writeFileSync('release/arm64/${{ inputs.node }}/node.version', '${{ steps.node-test-version.outputs.node-version }}');
}
}
else if('${{ inputs.os }}' == 'macos-14'){
else if(${{ runner.os }} == 'macOS'){
fs.writeFileSync('release/x64/${{ inputs.node }}/node.version', '${{ steps.node-test-version.outputs.node-version }}');
fs.writeFileSync('release/arm64/${{ inputs.node }}/node.version', '${{ steps.node-test-version.outputs.node-version }}');
}
Expand Down Expand Up @@ -100,7 +100,7 @@ runs:
key: '${{ inputs.os }}-${{ inputs.node}}'

- name: Build ia32
if: runner.os == 'Windows' && ${{ inputs.node <23 }}
if: (runner.os == 'Windows') && (inputs.node <23)
uses: ./.github/actions/build
with:
node: ${{ steps.node-test-version.outputs.node-version }}
Expand Down
32 changes: 32 additions & 0 deletions .github/actions/test-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,28 @@ runs:
os: ${{ inputs.os }}

- name: Create release folder
if: runner.os == 'Windows'
shell: pwsh
run: |
cmd /c if not exist "lib\native\win32\ia32\${{ inputs.node }}" mkdir "lib\native\win32\ia32\${{ inputs.node }}"
cmd /c if not exist "lib\native\win32\x64\${{ inputs.node }}" mkdir "lib\native\win32\x64\${{ inputs.node }}"
cmd /c if not exist "lib\native\win32\arm64\${{ inputs.node }}" mkdir "lib\native\win32\arm64\${{ inputs.node }}"
- name: Create release folder
if: runner.os == 'macOS'
uses: actions/github-script@v7
with:
result-encoding: string
script: |
try {
const fs = require('fs')
fs.mkdirSync('lib/native/darwin/x64/${{ inputs.node }}', { recursive: true });
fs.mkdirSync('lib/native/darwin/arm64/${{ inputs.node }}', { recursive: true });
} catch(err) {
core.error("Error creating release directory")
core.setFailed(err)
}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -37,10 +53,26 @@ runs:
run: ls -R release

- name: Copy artifacts
if: runner.os == 'Windows'
shell: pwsh
run: |
cmd /c copy /y release\edge-js-${{ inputs.node }}\x64\${{ inputs.node }}\edge_*.node lib\native\win32\x64\${{ inputs.node }}
- name: Copy artifacts
if: runner.os == 'macOS'
uses: actions/github-script@v7
with:
result-encoding: string
script: |
try {
const fs = require('fs')
fs.copyFileSync('release/edge-js-${{ inputs.node }}/x64/${{ inputs.node }}/edge_coreclr.node', 'lib/native/darwin/x64/${{ inputs.node }}/edge_coreclr.node');
fs.copyFileSync('release/edge-js-${{ inputs.node }}/x64/${{ inputs.node }}/edge_coreclr.node', 'lib/native/darwin/arm64/${{ inputs.node }}/edge_coreclr.node');
} catch(err) {
core.error("Error creating release directory")
core.setFailed(err)
}
- name: Test
uses: ./.github/actions/test-windows
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/actions/test-windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ runs:
length_from_start: 2

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

- name: Check edge-js macOS pre-built files
if: runner.os == 'macOS'
uses: andstor/file-existence-action@v3
with:
files: "lib/native/darwin/${{ runner.arch }}/${{ steps.node_version.outputs.substring }}/edge_coreclr.node"
fail: true
ignore_case: true

- name: Run .NET 4.5 tests
if: runner.os == 'Windows'
shell: bash
run: node tools/test.js CI

Expand Down
39 changes: 20 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,23 @@ jobs:
node: ${{ inputs.build-version }}
os: ${{ matrix.os }}

# test:
# runs-on: ${{ matrix.os }}
# needs: build
# strategy:
# matrix:
# os: [windows-2022]
# # fail-fast: false

# name: test ${{ matrix.os }}-node-${{ inputs.build-version }}
# steps:

# - name: Checkout code
# uses: actions/checkout@v4

# - name: Test build
# uses: ./.github/actions/test-build
# with:
# node: ${{ inputs.build-version }}
# os: ${{ matrix.os }}
test:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
# os: [windows-2022]
os: [macos-13, macod-14]
# fail-fast: false

name: test ${{ matrix.os }}-node-${{ inputs.build-version }}
steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Test build
uses: ./.github/actions/test-build
with:
node: ${{ inputs.build-version }}
os: ${{ matrix.os }}
2 changes: 1 addition & 1 deletion lib/edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (process.env.EDGE_NATIVE) {
else if (fs.existsSync(builtEdge)) {
edgeNative = builtEdge;
}
else if (process.platform === 'win32') {
else if (process.platform === 'win32' || process.platform === 'darwin') {
edgeNative = path.resolve(__dirname, './native/' + process.platform + '/' + process.arch + '/' + determineVersion() + '/' + (process.env.EDGE_USE_CORECLR ? 'edge_coreclr' : 'edge_nativeclr'));
}
else {
Expand Down
2 changes: 1 addition & 1 deletion tools/checkplatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ catch (e) {
console.log('***************************************');
}

console.log('Success: platform check for edge.js: node.js ' + process.arch + ' v' + process.versions.node);
console.log('Success: platform check for edge.js: ' + process.platform + '-' + process.arch + ' v' + process.versions.node);
31 changes: 23 additions & 8 deletions tools/install.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var fs = require('fs')
const fs = require('fs')
, path = require('path')
, spawn = require('child_process').spawn
, whereis = require('./whereis');

if (process.platform === 'win32') {
var libroot = path.resolve(__dirname, '../lib/native/win32')
const libroot = path.resolve(__dirname, '../lib/native/win32')
, lib32bit = path.resolve(libroot, 'ia32')
, lib64bit = path.resolve(libroot, 'x64')
, libarm64 = path.resolve(libroot, 'arm64');
Expand Down Expand Up @@ -47,16 +47,16 @@ if (process.platform === 'win32') {
.map(getPath);
}

var redist = [
const redist = [
'concrt140.dll',
'msvcp140.dll',
'vccorlib140.dll',
'vcruntime140.dll',
];

var dest32dirs = getDestDirs(lib32bit);
var dest64dirs = getDestDirs(lib64bit);
var destarmdirs = getDestDirs(libarm64);
const dest32dirs = getDestDirs(lib32bit);
const dest64dirs = getDestDirs(lib64bit);
const destarmdirs = getDestDirs(libarm64);

function copyRedist(lib, destDirs){
redist.forEach(function (dllname) {
Expand All @@ -69,7 +69,7 @@ if (process.platform === 'win32') {
copyRedist(lib64bit, dest64dirs);
copyRedist(libarm64, destarmdirs);

var dotnetPath = whereis('dotnet', 'dotnet.exe');
const dotnetPath = whereis('dotnet', 'dotnet.exe');

if (dotnetPath) {
spawn(dotnetPath, ['restore'], { stdio: 'inherit', cwd: path.resolve(__dirname, '..', 'lib', 'bootstrap') })
Expand All @@ -87,5 +87,20 @@ if (process.platform === 'win32') {
}

else {
spawn('node-gyp', ['configure', 'build'], { stdio: 'inherit' });
if(process.platform === 'darwin'){
const edjeNative = path.resolve(__dirname, '../lib/native/' + process.platform + '/' + process.arch + '/' + determineVersion() + '/' + 'edge_coreclr.node');
console.log(edjeNative)
if(fs.existsSync(edjeNative)){
spawn(dotnetPath, ['build', '--configuration', 'Release'], { stdio: 'inherit', cwd: path.resolve(__dirname, '..', 'lib', 'bootstrap') })
.on('close', function() {
require('./checkplatform');
});
}
else{
spawn('node-gyp', ['configure', 'build'], { stdio: 'inherit' });
}
}
else{
spawn('node-gyp', ['configure', 'build'], { stdio: 'inherit' });
}
}

0 comments on commit bf6bd10

Please sign in to comment.