diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 94a4cf24b..db25ed78c 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -15,7 +15,7 @@ jobs: fail-fast: true matrix: node: [20] - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout repository @@ -37,6 +37,7 @@ jobs: git submodule update --init --recursive npm ci npm run build - bash run-ci-benchmarks.sh + echo 'Running o1js benchmarks.' + node --enable-source-maps --stack-trace-limit=1000 src/build/run.js benchmark/runners/with-cloud-history.ts --bundle >>benchmarks.log 2>&1 cat benchmarks.log >> $GITHUB_STEP_SUMMARY shell: bash diff --git a/benchmark/benchmark.ts b/benchmark/benchmark.ts index 17ae0d981..c091fd64c 100644 --- a/benchmark/benchmark.ts +++ b/benchmark/benchmark.ts @@ -112,7 +112,7 @@ function logResult( result: BenchmarkResult, previousResult?: BenchmarkResult ): void { - console.log(result.label + `\n`); + console.log(result.label); console.log(`time: ${resultToString(result)}`); if (previousResult === undefined) return; diff --git a/src/build/build-example.js b/src/build/build-example.js index 2f3a37e37..966bf6088 100644 --- a/src/build/build-example.js +++ b/src/build/build-example.js @@ -2,6 +2,7 @@ import fs from 'fs/promises'; import path from 'path'; import ts from 'typescript'; import esbuild from 'esbuild'; +import { platform } from 'node:process'; export { buildAndImport, build, buildOne }; @@ -11,7 +12,7 @@ async function buildAndImport(srcPath, { keepFile = false }) { try { importedModule = await import(absPath); } finally { - if (!keepFile) await fs.unlink(absPath); + if (!keepFile) await fs.unlink(absPath.replace(/^file:\/\/\/*/, '')); } return importedModule; } @@ -44,6 +45,9 @@ async function build(srcPath, isWeb = false) { }); let absPath = path.resolve('.', outfile); + if (platform === 'win32') { + absPath = 'file:///' + absPath; + } return absPath; } @@ -70,6 +74,9 @@ async function buildOne(srcPath) { }); let absPath = path.resolve('.', outfile); + if (platform === 'win32') { + absPath = 'file:///' + absPath; + } return absPath; } @@ -104,13 +111,13 @@ function typescriptPlugin(tsConfig) { } function makeNodeModulesExternal() { - let isNodeModule = /^[^./]|^\.[^./]|^\.\.[^/]/; + let isNodeModule = /^[^./\\]|^\.[^./\\]|^\.\.[^/\\]/; return { name: 'plugin-external', setup(build) { build.onResolve({ filter: isNodeModule }, ({ path }) => ({ path, - external: true, + external: !(platform === 'win32' && path.endsWith('index.js')), })); }, }; diff --git a/src/build/build-node.js b/src/build/build-node.js index 4708bf5a8..4ba289033 100644 --- a/src/build/build-node.js +++ b/src/build/build-node.js @@ -1,4 +1,5 @@ import path from 'node:path'; +import { platform } from 'node:process'; import { fileURLToPath } from 'node:url'; import esbuild from 'esbuild'; import minimist from 'minimist'; @@ -46,13 +47,13 @@ async function buildNode({ production }) { } function makeNodeModulesExternal() { - let isNodeModule = /^[^./]|^\.[^./]|^\.\.[^/]/; + let isNodeModule = /^[^./\\]|^\.[^./\\]|^\.\.[^/\\]/; return { name: 'plugin-external', setup(build) { build.onResolve({ filter: isNodeModule }, ({ path }) => ({ path, - external: true, + external: !(platform === 'win32' && path.endsWith('index.js')), })); }, };