diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml deleted file mode 100644 index 501b16099..000000000 --- a/.github/workflows/perf.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Performance - -on: [pull_request] - -jobs: - perf: - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: ./.github/actions/install-swift - with: - download-url: https://download.swift.org/swift-6.0.3-release/ubuntu2404/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu24.04.tar.gz - - uses: swiftwasm/setup-swiftwasm@v2 - - name: Run Benchmark - run: | - make bootstrap - make perf-tester - node ci/perf-tester - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Benchmarks/Package.swift b/Benchmarks/Package.swift new file mode 100644 index 000000000..4d59c772e --- /dev/null +++ b/Benchmarks/Package.swift @@ -0,0 +1,20 @@ +// swift-tools-version: 6.0 + +import PackageDescription + +let package = Package( + name: "Benchmarks", + dependencies: [ + .package(path: "../") + ], + targets: [ + .executableTarget( + name: "Benchmarks", + dependencies: ["JavaScriptKit"], + exclude: ["Generated/JavaScript", "bridge.d.ts"], + swiftSettings: [ + .enableExperimentalFeature("Extern") + ] + ) + ] +) diff --git a/Benchmarks/README.md b/Benchmarks/README.md new file mode 100644 index 000000000..eeafc395a --- /dev/null +++ b/Benchmarks/README.md @@ -0,0 +1,30 @@ +# JavaScriptKit Benchmarks + +This directory contains performance benchmarks for JavaScriptKit. + +## Building Benchmarks + +Before running the benchmarks, you need to build the test suite: + +```bash +JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk $SWIFT_SDK_ID js -c release +``` + +## Running Benchmarks + +```bash +# Run with default settings +node run.js + +# Save results to a JSON file +node run.js --output=results.json + +# Specify number of iterations +node run.js --runs=20 + +# Run in adaptive mode until results stabilize +node run.js --adaptive --output=stable-results.json + +# Run benchmarks and compare with previous results +node run.js --baseline=previous-results.json +``` diff --git a/Benchmarks/Sources/Benchmarks.swift b/Benchmarks/Sources/Benchmarks.swift new file mode 100644 index 000000000..602aa843c --- /dev/null +++ b/Benchmarks/Sources/Benchmarks.swift @@ -0,0 +1,78 @@ +import JavaScriptKit + +class Benchmark { + init(_ title: String) { + self.title = title + } + + let title: String + + func testSuite(_ name: String, _ body: @escaping () -> Void) { + let jsBody = JSClosure { arguments -> JSValue in + body() + return .undefined + } + benchmarkRunner("\(title)/\(name)", jsBody) + } +} + +@JS func run() { + + let call = Benchmark("Call") + + call.testSuite("JavaScript function call through Wasm import") { + for _ in 0..<20_000_000 { + benchmarkHelperNoop() + } + } + + call.testSuite("JavaScript function call through Wasm import with int") { + for _ in 0..<10_000_000 { + benchmarkHelperNoopWithNumber(42) + } + } + + let propertyAccess = Benchmark("Property access") + + do { + let swiftInt: Double = 42 + let object = JSObject() + object.jsNumber = JSValue.number(swiftInt) + propertyAccess.testSuite("Write Number") { + for _ in 0..<1_000_000 { + object.jsNumber = JSValue.number(swiftInt) + } + } + } + + do { + let object = JSObject() + object.jsNumber = JSValue.number(42) + propertyAccess.testSuite("Read Number") { + for _ in 0..<1_000_000 { + _ = object.jsNumber.number + } + } + } + + do { + let swiftString = "Hello, world" + let object = JSObject() + object.jsString = swiftString.jsValue + propertyAccess.testSuite("Write String") { + for _ in 0..<1_000_000 { + object.jsString = swiftString.jsValue + } + } + } + + do { + let object = JSObject() + object.jsString = JSValue.string("Hello, world") + propertyAccess.testSuite("Read String") { + for _ in 0..<1_000_000 { + _ = object.jsString.string + } + } + } +} diff --git a/Benchmarks/Sources/Generated/ExportSwift.swift b/Benchmarks/Sources/Generated/ExportSwift.swift new file mode 100644 index 000000000..a8745b649 --- /dev/null +++ b/Benchmarks/Sources/Generated/ExportSwift.swift @@ -0,0 +1,15 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. +@_extern(wasm, module: "bjs", name: "return_string") +private func _return_string(_ ptr: UnsafePointer?, _ len: Int32) +@_extern(wasm, module: "bjs", name: "init_memory") +private func _init_memory(_ sourceId: Int32, _ ptr: UnsafeMutablePointer?) + +@_expose(wasm, "bjs_main") +@_cdecl("bjs_main") +public func _bjs_main() -> Void { + main() +} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/ImportTS.swift b/Benchmarks/Sources/Generated/ImportTS.swift new file mode 100644 index 000000000..583b9ba58 --- /dev/null +++ b/Benchmarks/Sources/Generated/ImportTS.swift @@ -0,0 +1,38 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +@_spi(JSObject_id) import JavaScriptKit + +@_extern(wasm, module: "bjs", name: "make_jsstring") +private func _make_jsstring(_ ptr: UnsafePointer?, _ len: Int32) -> Int32 + +@_extern(wasm, module: "bjs", name: "init_memory_with_result") +private func _init_memory_with_result(_ ptr: UnsafePointer?, _ len: Int32) + +@_extern(wasm, module: "bjs", name: "free_jsobject") +private func _free_jsobject(_ ptr: Int32) -> Void + +func benchmarkHelperNoop() -> Void { + @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") + func bjs_benchmarkHelperNoop() -> Void + bjs_benchmarkHelperNoop() +} + +func benchmarkHelperNoopWithNumber(_ n: Double) -> Void { + @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") + func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void + bjs_benchmarkHelperNoopWithNumber(n) +} + +func benchmarkRunner(_ name: String, _ body: JSObject) -> Void { + @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") + func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void + var name = name + let nameId = name.withUTF8 { b in + _make_jsstring(b.baseAddress.unsafelyUnwrapped, Int32(b.count)) + } + bjs_benchmarkRunner(nameId, Int32(bitPattern: body.id)) +} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/ExportSwift.json b/Benchmarks/Sources/Generated/JavaScript/ExportSwift.json new file mode 100644 index 000000000..0b1b70b70 --- /dev/null +++ b/Benchmarks/Sources/Generated/JavaScript/ExportSwift.json @@ -0,0 +1,19 @@ +{ + "classes" : [ + + ], + "functions" : [ + { + "abiName" : "bjs_main", + "name" : "main", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] +} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/ImportTS.json b/Benchmarks/Sources/Generated/JavaScript/ImportTS.json new file mode 100644 index 000000000..366342bbc --- /dev/null +++ b/Benchmarks/Sources/Generated/JavaScript/ImportTS.json @@ -0,0 +1,67 @@ +{ + "children" : [ + { + "functions" : [ + { + "name" : "benchmarkHelperNoop", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "benchmarkHelperNoopWithNumber", + "parameters" : [ + { + "name" : "n", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "benchmarkRunner", + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "body", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + } + ], + "moduleName" : "Benchmarks" +} \ No newline at end of file diff --git a/Benchmarks/Sources/bridge.d.ts b/Benchmarks/Sources/bridge.d.ts new file mode 100644 index 000000000..a9eb5d0bf --- /dev/null +++ b/Benchmarks/Sources/bridge.d.ts @@ -0,0 +1,3 @@ +declare function benchmarkHelperNoop(): void; +declare function benchmarkHelperNoopWithNumber(n: number): void; +declare function benchmarkRunner(name: string, body: (n: number) => void): void; diff --git a/Benchmarks/package.json b/Benchmarks/package.json new file mode 100644 index 000000000..5ffd9800b --- /dev/null +++ b/Benchmarks/package.json @@ -0,0 +1 @@ +{ "type": "module" } diff --git a/Benchmarks/run.js b/Benchmarks/run.js new file mode 100644 index 000000000..2305373a5 --- /dev/null +++ b/Benchmarks/run.js @@ -0,0 +1,449 @@ +import { instantiate } from "./.build/plugins/PackageToJS/outputs/Package/instantiate.js" +import { defaultNodeSetup } from "./.build/plugins/PackageToJS/outputs/Package/platforms/node.js" +import fs from 'fs'; +import path from 'path'; +import { parseArgs } from "util"; + +/** + * Update progress bar on the current line + * @param {number} current - Current progress + * @param {number} total - Total items + * @param {string} label - Label for the progress bar + * @param {number} width - Width of the progress bar + */ +function updateProgress(current, total, label = '', width) { + const percent = (current / total) * 100; + const completed = Math.round(width * (percent / 100)); + const remaining = width - completed; + const bar = '█'.repeat(completed) + '░'.repeat(remaining); + process.stdout.clearLine(); + process.stdout.cursorTo(0); + process.stdout.write(`${label} [${bar}] ${current}/${total}`); +} + +/** + * Calculate coefficient of variation (relative standard deviation) + * @param {Array} values - Array of measurement values + * @returns {number} Coefficient of variation as a percentage + */ +function calculateCV(values) { + if (values.length < 2) return 0; + + const sum = values.reduce((a, b) => a + b, 0); + const mean = sum / values.length; + + if (mean === 0) return 0; + + const variance = values.reduce((a, b) => a + Math.pow(b - mean, 2), 0) / values.length; + const stdDev = Math.sqrt(variance); + + return (stdDev / mean) * 100; // Return as percentage +} + +/** + * Calculate statistics from benchmark results + * @param {Object} results - Raw benchmark results + * @returns {Object} Formatted results with statistics + */ +function calculateStatistics(results) { + const formattedResults = {}; + const consoleTable = []; + + for (const [name, times] of Object.entries(results)) { + const sum = times.reduce((a, b) => a + b, 0); + const avg = sum / times.length; + const min = Math.min(...times); + const max = Math.max(...times); + const variance = times.reduce((a, b) => a + Math.pow(b - avg, 2), 0) / times.length; + const stdDev = Math.sqrt(variance); + const cv = (stdDev / avg) * 100; // Coefficient of variation as percentage + + formattedResults[name] = { + "avg_ms": parseFloat(avg.toFixed(2)), + "min_ms": parseFloat(min.toFixed(2)), + "max_ms": parseFloat(max.toFixed(2)), + "stdDev_ms": parseFloat(stdDev.toFixed(2)), + "cv_percent": parseFloat(cv.toFixed(2)), + "samples": times.length, + "rawTimes_ms": times.map(t => parseFloat(t.toFixed(2))) + }; + + consoleTable.push({ + Test: name, + 'Avg (ms)': avg.toFixed(2), + 'Min (ms)': min.toFixed(2), + 'Max (ms)': max.toFixed(2), + 'StdDev (ms)': stdDev.toFixed(2), + 'CV (%)': cv.toFixed(2), + 'Samples': times.length + }); + } + + return { formattedResults, consoleTable }; +} + +/** + * Load a JSON file + * @param {string} filePath - Path to the JSON file + * @returns {Object|null} Parsed JSON or null if file doesn't exist + */ +function loadJsonFile(filePath) { + try { + if (fs.existsSync(filePath)) { + const fileContent = fs.readFileSync(filePath, 'utf8'); + return JSON.parse(fileContent); + } + } catch (error) { + console.error(`Error loading JSON file ${filePath}:`, error.message); + } + return null; +} + +/** + * Compare current results with baseline + * @param {Object} current - Current benchmark results + * @param {Object} baseline - Baseline benchmark results + * @returns {Object} Comparison results with percent change + */ +function compareWithBaseline(current, baseline) { + const comparisonTable = []; + + // Get all unique test names from both current and baseline + const allTests = new Set([ + ...Object.keys(current), + ...Object.keys(baseline) + ]); + + for (const test of allTests) { + const currentTest = current[test]; + const baselineTest = baseline[test]; + + if (!currentTest) { + comparisonTable.push({ + Test: test, + 'Status': 'REMOVED', + 'Baseline (ms)': baselineTest.avg_ms.toFixed(2), + 'Current (ms)': 'N/A', + 'Change': 'N/A', + 'Change (%)': 'N/A' + }); + continue; + } + + if (!baselineTest) { + comparisonTable.push({ + Test: test, + 'Status': 'NEW', + 'Baseline (ms)': 'N/A', + 'Current (ms)': currentTest.avg_ms.toFixed(2), + 'Change': 'N/A', + 'Change (%)': 'N/A' + }); + continue; + } + + const change = currentTest.avg_ms - baselineTest.avg_ms; + const percentChange = (change / baselineTest.avg_ms) * 100; + + let status = 'NEUTRAL'; + if (percentChange < -5) status = 'FASTER'; + else if (percentChange > 5) status = 'SLOWER'; + + comparisonTable.push({ + Test: test, + 'Status': status, + 'Baseline (ms)': baselineTest.avg_ms.toFixed(2), + 'Current (ms)': currentTest.avg_ms.toFixed(2), + 'Change': (0 < change ? '+' : '') + change.toFixed(2) + ' ms', + 'Change (%)': (0 < percentChange ? '+' : '') + percentChange.toFixed(2) + '%' + }); + } + + return comparisonTable; +} + +/** + * Format and print comparison results + * @param {Array} comparisonTable - Comparison results + */ +function printComparisonResults(comparisonTable) { + console.log("\n=============================="); + console.log(" COMPARISON WITH BASELINE "); + console.log("==============================\n"); + + // Color code the output if terminal supports it + const colorize = (text, status) => { + if (process.stdout.isTTY) { + if (status === 'FASTER') return `\x1b[32m${text}\x1b[0m`; // Green + if (status === 'SLOWER') return `\x1b[31m${text}\x1b[0m`; // Red + if (status === 'NEW') return `\x1b[36m${text}\x1b[0m`; // Cyan + if (status === 'REMOVED') return `\x1b[33m${text}\x1b[0m`; // Yellow + } + return text; + }; + + // Manually format table for better control over colors + const columnWidths = { + Test: Math.max(4, ...comparisonTable.map(row => row.Test.length)), + Status: 8, + Baseline: 15, + Current: 15, + Change: 15, + PercentChange: 15 + }; + + // Print header + console.log( + 'Test'.padEnd(columnWidths.Test) + ' | ' + + 'Status'.padEnd(columnWidths.Status) + ' | ' + + 'Baseline (ms)'.padEnd(columnWidths.Baseline) + ' | ' + + 'Current (ms)'.padEnd(columnWidths.Current) + ' | ' + + 'Change'.padEnd(columnWidths.Change) + ' | ' + + 'Change (%)' + ); + + console.log('-'.repeat(columnWidths.Test + columnWidths.Status + columnWidths.Baseline + + columnWidths.Current + columnWidths.Change + columnWidths.PercentChange + 10)); + + // Print rows + for (const row of comparisonTable) { + console.log( + row.Test.padEnd(columnWidths.Test) + ' | ' + + colorize(row.Status.padEnd(columnWidths.Status), row.Status) + ' | ' + + row['Baseline (ms)'].toString().padEnd(columnWidths.Baseline) + ' | ' + + row['Current (ms)'].toString().padEnd(columnWidths.Current) + ' | ' + + colorize(row.Change.padEnd(columnWidths.Change), row.Status) + ' | ' + + colorize(row['Change (%)'].padEnd(columnWidths.PercentChange), row.Status) + ); + } +} + +/** + * Save results to JSON file + * @param {string} filePath - Output file path + * @param {Object} data - Data to save + */ +function saveJsonResults(filePath, data) { + const outputDir = path.dirname(filePath); + if (outputDir !== '.' && !fs.existsSync(outputDir)) { + fs.mkdirSync(outputDir, { recursive: true }); + } + + fs.writeFileSync(filePath, JSON.stringify(data, null, 2)); + console.log(`\nDetailed results saved to ${filePath}`); +} + +/** + * Run a single benchmark iteration + * @param {Object} results - Results object to store benchmark data + * @returns {Promise} + */ +async function singleRun(results) { + const options = await defaultNodeSetup({}) + const { exports } = await instantiate({ + ...options, + imports: { + benchmarkHelperNoop: () => { }, + benchmarkHelperNoopWithNumber: (n) => { }, + benchmarkRunner: (name, body) => { + const startTime = performance.now(); + body(); + const endTime = performance.now(); + const duration = endTime - startTime; + if (!results[name]) { + results[name] = [] + } + results[name].push(duration) + } + } + }); + exports.run(); +} + +/** + * Run until the coefficient of variation of measurements is below the threshold + * @param {Object} results - Benchmark results object + * @param {Object} options - Adaptive sampling options + * @returns {Promise} + */ +async function runUntilStable(results, options, width) { + const { + minRuns = 5, + maxRuns = 50, + targetCV = 5, + } = options; + + let runs = 0; + let allStable = false; + + console.log("\nAdaptive sampling enabled:"); + console.log(`- Minimum runs: ${minRuns}`); + console.log(`- Maximum runs: ${maxRuns}`); + console.log(`- Target CV: ${targetCV}%`); + + while (runs < maxRuns) { + // Update progress with estimated completion + updateProgress(runs, maxRuns, "Benchmark Progress:", width); + + await singleRun(results); + runs++; + + // Check if we've reached minimum runs + if (runs < minRuns) continue; + + // Check stability of all tests after each run + const cvs = []; + allStable = true; + + for (const [name, times] of Object.entries(results)) { + const cv = calculateCV(times); + cvs.push({ name, cv }); + + if (cv > targetCV) { + allStable = false; + } + } + + // Display current CV values periodically + if (runs % 3 === 0 || allStable) { + process.stdout.write("\n"); + console.log(`After ${runs} runs, coefficient of variation (%):`) + for (const { name, cv } of cvs) { + const stable = cv <= targetCV; + const status = stable ? '✓' : '…'; + const cvStr = cv.toFixed(2) + '%'; + console.log(` ${status} ${name}: ${stable ? '\x1b[32m' : ''}${cvStr}${stable ? '\x1b[0m' : ''}`); + } + } + + // Check if we should stop + if (allStable) { + console.log("\nAll benchmarks stable! Stopping adaptive sampling."); + break; + } + } + + updateProgress(maxRuns, maxRuns, "Benchmark Progress:", width); + console.log("\n"); + + if (!allStable) { + console.log("\nWarning: Not all benchmarks reached target stability!"); + for (const [name, times] of Object.entries(results)) { + const cv = calculateCV(times); + if (cv > targetCV) { + console.log(` ! ${name}: ${cv.toFixed(2)}% > ${targetCV}%`); + } + } + } +} + +function showHelp() { + console.log(` +Usage: node run.js [options] + +Options: + --runs=NUMBER Number of benchmark runs (default: 10) + --output=FILENAME Save JSON results to specified file + --baseline=FILENAME Compare results with baseline JSON file + --adaptive Enable adaptive sampling (run until stable) + --min-runs=NUMBER Minimum runs for adaptive sampling (default: 5) + --max-runs=NUMBER Maximum runs for adaptive sampling (default: 50) + --target-cv=NUMBER Target coefficient of variation % (default: 5) + --help Show this help message +`); +} + +async function main() { + const args = parseArgs({ + options: { + runs: { type: 'string', default: '10' }, + output: { type: 'string' }, + baseline: { type: 'string' }, + help: { type: 'boolean', default: false }, + adaptive: { type: 'boolean', default: false }, + 'min-runs': { type: 'string', default: '5' }, + 'max-runs': { type: 'string', default: '50' }, + 'target-cv': { type: 'string', default: '5' } + } + }); + + if (args.values.help) { + showHelp(); + return; + } + + const results = {}; + const width = 30; + + if (args.values.adaptive) { + // Adaptive sampling mode + const options = { + minRuns: parseInt(args.values['min-runs'], 10), + maxRuns: parseInt(args.values['max-runs'], 10), + targetCV: parseFloat(args.values['target-cv']) + }; + + console.log("Starting benchmark with adaptive sampling..."); + if (args.values.output) { + console.log(`Results will be saved to: ${args.values.output}`); + } + + await runUntilStable(results, options, width); + } else { + // Fixed number of runs mode + const runs = parseInt(args.values.runs, 10); + if (isNaN(runs)) { + console.error('Invalid number of runs:', args.values.runs); + process.exit(1); + } + + console.log(`Starting benchmark suite with ${runs} runs per test...`); + if (args.values.output) { + console.log(`Results will be saved to: ${args.values.output}`); + } + + if (args.values.baseline) { + console.log(`Will compare with baseline: ${args.values.baseline}`); + } + + // Show overall progress + console.log("\nOverall Progress:"); + for (let i = 0; i < runs; i++) { + updateProgress(i, runs, "Benchmark Runs:", width); + await singleRun(results); + } + updateProgress(runs, runs, "Benchmark Runs:", width); + console.log("\n"); + } + + // Calculate and display statistics + console.log("\n=============================="); + console.log(" BENCHMARK SUMMARY "); + console.log("==============================\n"); + + const { formattedResults, consoleTable } = calculateStatistics(results); + + // Print readable format to console + console.table(consoleTable); + + // Compare with baseline if provided + if (args.values.baseline) { + const baseline = loadJsonFile(args.values.baseline); + if (baseline) { + const comparisonResults = compareWithBaseline(formattedResults, baseline); + printComparisonResults(comparisonResults); + } else { + console.error(`Could not load baseline file: ${args.values.baseline}`); + } + } + + // Save JSON to file if specified + if (args.values.output) { + saveJsonResults(args.values.output, formattedResults); + } +} + +main().catch(err => { + console.error('Benchmark error:', err); + process.exit(1); +}); diff --git a/IntegrationTests/Makefile b/IntegrationTests/Makefile deleted file mode 100644 index 54a656fd1..000000000 --- a/IntegrationTests/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -CONFIGURATION ?= debug -SWIFT_BUILD_FLAGS ?= -NODEJS_FLAGS ?= - -NODEJS = node --experimental-wasi-unstable-preview1 $(NODEJS_FLAGS) - -FORCE: -TestSuites/.build/$(CONFIGURATION)/%.wasm: FORCE - swift build --package-path TestSuites \ - --product $(basename $(notdir $@)) \ - --configuration $(CONFIGURATION) \ - -Xswiftc -Xclang-linker -Xswiftc -mexec-model=reactor \ - -Xlinker --export-if-defined=main -Xlinker --export-if-defined=__main_argc_argv \ - --static-swift-stdlib -Xswiftc -static-stdlib \ - $(SWIFT_BUILD_FLAGS) - -dist/%.wasm: TestSuites/.build/$(CONFIGURATION)/%.wasm - mkdir -p dist - cp $< $@ - -node_modules: package-lock.json - npm ci - -.PHONY: build_rt -build_rt: node_modules - cd .. && npm run build - -.PHONY: benchmark_setup -benchmark_setup: build_rt dist/BenchmarkTests.wasm - -.PHONY: run_benchmark -run_benchmark: - $(NODEJS) bin/benchmark-tests.js - -.PHONY: benchmark -benchmark: benchmark_setup run_benchmark diff --git a/IntegrationTests/TestSuites/.gitignore b/IntegrationTests/TestSuites/.gitignore deleted file mode 100644 index 95c432091..000000000 --- a/IntegrationTests/TestSuites/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.DS_Store -/.build -/Packages -/*.xcodeproj -xcuserdata/ diff --git a/IntegrationTests/TestSuites/Package.swift b/IntegrationTests/TestSuites/Package.swift deleted file mode 100644 index 1ae22dfa5..000000000 --- a/IntegrationTests/TestSuites/Package.swift +++ /dev/null @@ -1,24 +0,0 @@ -// swift-tools-version:5.7 - -import PackageDescription - -let package = Package( - name: "TestSuites", - platforms: [ - // This package doesn't work on macOS host, but should be able to be built for it - // for developing on Xcode. This minimum version requirement is to prevent availability - // errors for Concurrency API, whose runtime support is shipped from macOS 12.0 - .macOS("12.0") - ], - products: [ - .executable( - name: "BenchmarkTests", - targets: ["BenchmarkTests"] - ) - ], - dependencies: [.package(name: "JavaScriptKit", path: "../../")], - targets: [ - .target(name: "CHelpers"), - .executableTarget(name: "BenchmarkTests", dependencies: ["JavaScriptKit", "CHelpers"]), - ] -) diff --git a/IntegrationTests/TestSuites/Sources/BenchmarkTests/Benchmark.swift b/IntegrationTests/TestSuites/Sources/BenchmarkTests/Benchmark.swift deleted file mode 100644 index 4562898fb..000000000 --- a/IntegrationTests/TestSuites/Sources/BenchmarkTests/Benchmark.swift +++ /dev/null @@ -1,19 +0,0 @@ -import JavaScriptKit - -class Benchmark { - init(_ title: String) { - self.title = title - } - - let title: String - let runner = JSObject.global.benchmarkRunner.function! - - func testSuite(_ name: String, _ body: @escaping (Int) -> Void) { - let jsBody = JSClosure { arguments -> JSValue in - let iteration = Int(arguments[0].number!) - body(iteration) - return .undefined - } - runner("\(title)/\(name)", jsBody) - } -} diff --git a/IntegrationTests/TestSuites/Sources/BenchmarkTests/main.swift b/IntegrationTests/TestSuites/Sources/BenchmarkTests/main.swift deleted file mode 100644 index 6bd10835b..000000000 --- a/IntegrationTests/TestSuites/Sources/BenchmarkTests/main.swift +++ /dev/null @@ -1,85 +0,0 @@ -import CHelpers -import JavaScriptKit - -let serialization = Benchmark("Serialization") - -let noopFunction = JSObject.global.noopFunction.function! - -serialization.testSuite("JavaScript function call through Wasm import") { n in - for _ in 0.. { - body(iteration); - }); - } -} - -const serialization = new JSBenchmark("Serialization"); -serialization.testSuite("Call JavaScript function directly", (n) => { - for (let idx = 0; idx < n; idx++) { - global.noopFunction() - } -}); - -serialization.testSuite("Assign JavaScript number directly", (n) => { - const jsNumber = 42; - const object = global; - const key = "numberValue" - for (let idx = 0; idx < n; idx++) { - object[key] = jsNumber; - } -}); - -serialization.testSuite("Call with JavaScript number directly", (n) => { - const jsNumber = 42; - for (let idx = 0; idx < n; idx++) { - global.noopFunction(jsNumber) - } -}); - -serialization.testSuite("Write JavaScript string directly", (n) => { - const jsString = "Hello, world"; - const object = global; - const key = "stringValue" - for (let idx = 0; idx < n; idx++) { - object[key] = jsString; - } -}); - -serialization.testSuite("Call with JavaScript string directly", (n) => { - const jsString = "Hello, world"; - for (let idx = 0; idx < n; idx++) { - global.noopFunction(jsString) - } -}); - -startWasiTask("./dist/BenchmarkTests.wasm").catch((err) => { - console.log(err); -}); diff --git a/IntegrationTests/lib.js b/IntegrationTests/lib.js deleted file mode 100644 index d9c424f0e..000000000 --- a/IntegrationTests/lib.js +++ /dev/null @@ -1,86 +0,0 @@ -import { SwiftRuntime } from "javascript-kit-swift" -import { WASI as NodeWASI } from "wasi" -import { WASI as MicroWASI, useAll } from "uwasi" -import * as fs from "fs/promises" -import path from "path"; - -const WASI = { - MicroWASI: ({ args }) => { - const wasi = new MicroWASI({ - args: args, - env: {}, - features: [useAll()], - }) - - return { - wasiImport: wasi.wasiImport, - setInstance(instance) { - wasi.instance = instance; - }, - start(instance, swift) { - wasi.initialize(instance); - swift.main(); - } - } - }, - Node: ({ args }) => { - const wasi = new NodeWASI({ - args: args, - env: {}, - preopens: { - "/": "./", - }, - returnOnExit: false, - version: "preview1", - }) - - return { - wasiImport: wasi.wasiImport, - start(instance, swift) { - wasi.initialize(instance); - swift.main(); - } - } - }, -}; - -const selectWASIBackend = () => { - const value = process.env["JAVASCRIPTKIT_WASI_BACKEND"] - if (value) { - return value; - } - return "Node" -}; - -function constructBaseImportObject(wasi, swift) { - return { - wasi_snapshot_preview1: wasi.wasiImport, - javascript_kit: swift.wasmImports, - benchmark_helper: { - noop: () => {}, - noop_with_int: (_) => {}, - }, - } -} - -export const startWasiTask = async (wasmPath, wasiConstructorKey = selectWASIBackend()) => { - // Fetch our Wasm File - const wasmBinary = await fs.readFile(wasmPath); - const programName = wasmPath; - const args = [path.basename(programName)]; - args.push(...process.argv.slice(3)); - const wasi = WASI[wasiConstructorKey]({ args }); - - const module = await WebAssembly.compile(wasmBinary); - - const swift = new SwiftRuntime(); - - const importObject = constructBaseImportObject(wasi, swift); - - // Instantiate the WebAssembly file - const instance = await WebAssembly.instantiate(module, importObject); - - swift.setInstance(instance); - // Start the WebAssembly WASI instance! - wasi.start(instance, swift); -}; diff --git a/IntegrationTests/package-lock.json b/IntegrationTests/package-lock.json deleted file mode 100644 index 9ea81b961..000000000 --- a/IntegrationTests/package-lock.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "IntegrationTests", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "dependencies": { - "javascript-kit-swift": "file:..", - "uwasi": "^1.2.0" - } - }, - "..": { - "name": "javascript-kit-swift", - "version": "0.0.0", - "license": "MIT", - "devDependencies": { - "@rollup/plugin-typescript": "^8.3.1", - "prettier": "2.6.1", - "rollup": "^2.70.0", - "tslib": "^2.3.1", - "typescript": "^4.6.3" - } - }, - "../node_modules/prettier": { - "version": "2.1.2", - "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "../node_modules/typescript": { - "version": "4.4.2", - "integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/javascript-kit-swift": { - "resolved": "..", - "link": true - }, - "node_modules/uwasi": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/uwasi/-/uwasi-1.2.0.tgz", - "integrity": "sha512-+U3ajjQgx/Xh1/ZNrgH0EzM5qI2czr94oz3DPDwTvUIlM4SFpDjTqJzDA3xcqlTmpp2YGpxApmjwZfablMUoOg==" - } - }, - "dependencies": { - "javascript-kit-swift": { - "version": "file:..", - "requires": { - "@rollup/plugin-typescript": "^8.3.1", - "prettier": "2.6.1", - "rollup": "^2.70.0", - "tslib": "^2.3.1", - "typescript": "^4.6.3" - }, - "dependencies": { - "prettier": { - "version": "2.1.2", - "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", - "dev": true - }, - "typescript": { - "version": "4.4.2", - "integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==", - "dev": true - } - } - }, - "uwasi": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/uwasi/-/uwasi-1.2.0.tgz", - "integrity": "sha512-+U3ajjQgx/Xh1/ZNrgH0EzM5qI2czr94oz3DPDwTvUIlM4SFpDjTqJzDA3xcqlTmpp2YGpxApmjwZfablMUoOg==" - } - } -} diff --git a/IntegrationTests/package.json b/IntegrationTests/package.json deleted file mode 100644 index 8491e91fb..000000000 --- a/IntegrationTests/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "private": true, - "type": "module", - "dependencies": { - "uwasi": "^1.2.0", - "javascript-kit-swift": "file:.." - } -} diff --git a/Makefile b/Makefile index 761010bd9..1524ba1ba 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,6 @@ bootstrap: npm ci npx playwright install -.PHONY: build -build: - swift build --triple wasm32-unknown-wasi - npm run build - .PHONY: unittest unittest: @echo Running unit tests @@ -24,18 +19,6 @@ unittest: -Xlinker stack-size=524288 \ js test --prelude ./Tests/prelude.mjs -.PHONY: benchmark_setup -benchmark_setup: - SWIFT_BUILD_FLAGS="$(SWIFT_BUILD_FLAGS)" CONFIGURATION=release $(MAKE) -C IntegrationTests benchmark_setup - -.PHONY: run_benchmark -run_benchmark: - SWIFT_BUILD_FLAGS="$(SWIFT_BUILD_FLAGS)" CONFIGURATION=release $(MAKE) -s -C IntegrationTests run_benchmark - -.PHONY: perf-tester -perf-tester: - cd ci/perf-tester && npm ci - .PHONY: regenerate_swiftpm_resources regenerate_swiftpm_resources: npm run build diff --git a/ci/perf-tester/package-lock.json b/ci/perf-tester/package-lock.json deleted file mode 100644 index 82918bd59..000000000 --- a/ci/perf-tester/package-lock.json +++ /dev/null @@ -1,924 +0,0 @@ -{ - "name": "perf-tester", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "devDependencies": { - "@actions/core": "^1.9.1", - "@actions/exec": "^1.0.3", - "@actions/github": "^2.0.1" - } - }, - "node_modules/@actions/core": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz", - "integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==", - "dev": true, - "dependencies": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - } - }, - "node_modules/@actions/exec": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz", - "integrity": "sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA==", - "dev": true, - "dependencies": { - "@actions/io": "^1.0.1" - } - }, - "node_modules/@actions/github": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-2.0.1.tgz", - "integrity": "sha512-C7dAsCkpPi1HxTzLldz+oY+9c5G+nnaK7xgk8KA83VVGlrGK7d603E3snUAFocWrqEu/uvdYD82ytggjcpYSQA==", - "dev": true, - "dependencies": { - "@octokit/graphql": "^4.3.1", - "@octokit/rest": "^16.15.0" - } - }, - "node_modules/@actions/http-client": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", - "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", - "dev": true, - "dependencies": { - "tunnel": "^0.0.6" - } - }, - "node_modules/@actions/io": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz", - "integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==", - "dev": true - }, - "node_modules/@octokit/endpoint": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.5.1.tgz", - "integrity": "sha512-nBFhRUb5YzVTCX/iAK1MgQ4uWo89Gu0TH00qQHoYRCsE12dWcG1OiLd7v2EIo2+tpUKPMOQ62QFy9hy9Vg2ULg==", - "dev": true, - "dependencies": { - "@octokit/types": "^2.0.0", - "is-plain-object": "^3.0.0", - "universal-user-agent": "^4.0.0" - } - }, - "node_modules/@octokit/graphql": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.3.1.tgz", - "integrity": "sha512-hCdTjfvrK+ilU2keAdqNBWOk+gm1kai1ZcdjRfB30oA3/T6n53UVJb7w0L5cR3/rhU91xT3HSqCd+qbvH06yxA==", - "dev": true, - "dependencies": { - "@octokit/request": "^5.3.0", - "@octokit/types": "^2.0.0", - "universal-user-agent": "^4.0.0" - } - }, - "node_modules/@octokit/request": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.3.1.tgz", - "integrity": "sha512-5/X0AL1ZgoU32fAepTfEoggFinO3rxsMLtzhlUX+RctLrusn/CApJuGFCd0v7GMFhF+8UiCsTTfsu7Fh1HnEJg==", - "dev": true, - "dependencies": { - "@octokit/endpoint": "^5.5.0", - "@octokit/request-error": "^1.0.1", - "@octokit/types": "^2.0.0", - "deprecation": "^2.0.0", - "is-plain-object": "^3.0.0", - "node-fetch": "^2.3.0", - "once": "^1.4.0", - "universal-user-agent": "^4.0.0" - } - }, - "node_modules/@octokit/request-error": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.0.tgz", - "integrity": "sha512-DNBhROBYjjV/I9n7A8kVkmQNkqFAMem90dSxqvPq57e2hBr7mNTX98y3R2zDpqMQHVRpBDjsvsfIGgBzy+4PAg==", - "dev": true, - "dependencies": { - "@octokit/types": "^2.0.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "node_modules/@octokit/rest": { - "version": "16.37.0", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.37.0.tgz", - "integrity": "sha512-qLPK9FOCK4iVpn6ghknNuv/gDDxXQG6+JBQvoCwWjQESyis9uemakjzN36nvvp8SCny7JuzHI2RV8ChbV5mYdQ==", - "dev": true, - "dependencies": { - "@octokit/request": "^5.2.0", - "@octokit/request-error": "^1.0.2", - "atob-lite": "^2.0.0", - "before-after-hook": "^2.0.0", - "btoa-lite": "^1.0.0", - "deprecation": "^2.0.0", - "lodash.get": "^4.4.2", - "lodash.set": "^4.3.2", - "lodash.uniq": "^4.5.0", - "octokit-pagination-methods": "^1.1.0", - "once": "^1.4.0", - "universal-user-agent": "^4.0.0" - } - }, - "node_modules/@octokit/types": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.1.0.tgz", - "integrity": "sha512-n1GUYFgKm5glcy0E+U5jnqAFY2p04rnK4A0YhuM70C7Vm9Vyx+xYwd/WOTEr8nUJcbPSR/XL+/26+rirY6jJQA==", - "dev": true, - "dependencies": { - "@types/node": ">= 8" - } - }, - "node_modules/@types/node": { - "version": "13.1.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.1.8.tgz", - "integrity": "sha512-6XzyyNM9EKQW4HKuzbo/CkOIjn/evtCmsU+MUM1xDfJ+3/rNjBttM1NgN7AOQvN6tP1Sl1D1PIKMreTArnxM9A==", - "dev": true - }, - "node_modules/atob-lite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", - "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=", - "dev": true - }, - "node_modules/before-after-hook": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", - "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==", - "dev": true - }, - "node_modules/btoa-lite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", - "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=", - "dev": true - }, - "node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/is-plain-object": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz", - "integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==", - "dev": true, - "dependencies": { - "isobject": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "node_modules/isobject": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz", - "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", - "dev": true - }, - "node_modules/lodash.set": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", - "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=", - "dev": true - }, - "node_modules/lodash.uniq": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", - "dev": true - }, - "node_modules/macos-release": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz", - "integrity": "sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/octokit-pagination-methods": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", - "integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==", - "dev": true - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/os-name": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", - "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", - "dev": true, - "dependencies": { - "macos-release": "^2.2.0", - "windows-release": "^3.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "node_modules/strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true - }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "dev": true, - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, - "node_modules/universal-user-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz", - "integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==", - "dev": true, - "dependencies": { - "os-name": "^3.1.0" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", - "dev": true - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/windows-release": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz", - "integrity": "sha512-QTlz2hKLrdqukrsapKsINzqMgOUpQW268eJ0OaOpJN32h272waxR9fkB9VoWRtK7uKHG5EHJcTXQBD8XZVJkFA==", - "dev": true, - "dependencies": { - "execa": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - } - }, - "dependencies": { - "@actions/core": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz", - "integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==", - "dev": true, - "requires": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - } - }, - "@actions/exec": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz", - "integrity": "sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA==", - "dev": true, - "requires": { - "@actions/io": "^1.0.1" - } - }, - "@actions/github": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-2.0.1.tgz", - "integrity": "sha512-C7dAsCkpPi1HxTzLldz+oY+9c5G+nnaK7xgk8KA83VVGlrGK7d603E3snUAFocWrqEu/uvdYD82ytggjcpYSQA==", - "dev": true, - "requires": { - "@octokit/graphql": "^4.3.1", - "@octokit/rest": "^16.15.0" - } - }, - "@actions/http-client": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", - "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", - "dev": true, - "requires": { - "tunnel": "^0.0.6" - } - }, - "@actions/io": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz", - "integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==", - "dev": true - }, - "@octokit/endpoint": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.5.1.tgz", - "integrity": "sha512-nBFhRUb5YzVTCX/iAK1MgQ4uWo89Gu0TH00qQHoYRCsE12dWcG1OiLd7v2EIo2+tpUKPMOQ62QFy9hy9Vg2ULg==", - "dev": true, - "requires": { - "@octokit/types": "^2.0.0", - "is-plain-object": "^3.0.0", - "universal-user-agent": "^4.0.0" - } - }, - "@octokit/graphql": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.3.1.tgz", - "integrity": "sha512-hCdTjfvrK+ilU2keAdqNBWOk+gm1kai1ZcdjRfB30oA3/T6n53UVJb7w0L5cR3/rhU91xT3HSqCd+qbvH06yxA==", - "dev": true, - "requires": { - "@octokit/request": "^5.3.0", - "@octokit/types": "^2.0.0", - "universal-user-agent": "^4.0.0" - } - }, - "@octokit/request": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.3.1.tgz", - "integrity": "sha512-5/X0AL1ZgoU32fAepTfEoggFinO3rxsMLtzhlUX+RctLrusn/CApJuGFCd0v7GMFhF+8UiCsTTfsu7Fh1HnEJg==", - "dev": true, - "requires": { - "@octokit/endpoint": "^5.5.0", - "@octokit/request-error": "^1.0.1", - "@octokit/types": "^2.0.0", - "deprecation": "^2.0.0", - "is-plain-object": "^3.0.0", - "node-fetch": "^2.3.0", - "once": "^1.4.0", - "universal-user-agent": "^4.0.0" - } - }, - "@octokit/request-error": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.0.tgz", - "integrity": "sha512-DNBhROBYjjV/I9n7A8kVkmQNkqFAMem90dSxqvPq57e2hBr7mNTX98y3R2zDpqMQHVRpBDjsvsfIGgBzy+4PAg==", - "dev": true, - "requires": { - "@octokit/types": "^2.0.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "@octokit/rest": { - "version": "16.37.0", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.37.0.tgz", - "integrity": "sha512-qLPK9FOCK4iVpn6ghknNuv/gDDxXQG6+JBQvoCwWjQESyis9uemakjzN36nvvp8SCny7JuzHI2RV8ChbV5mYdQ==", - "dev": true, - "requires": { - "@octokit/request": "^5.2.0", - "@octokit/request-error": "^1.0.2", - "atob-lite": "^2.0.0", - "before-after-hook": "^2.0.0", - "btoa-lite": "^1.0.0", - "deprecation": "^2.0.0", - "lodash.get": "^4.4.2", - "lodash.set": "^4.3.2", - "lodash.uniq": "^4.5.0", - "octokit-pagination-methods": "^1.1.0", - "once": "^1.4.0", - "universal-user-agent": "^4.0.0" - } - }, - "@octokit/types": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.1.0.tgz", - "integrity": "sha512-n1GUYFgKm5glcy0E+U5jnqAFY2p04rnK4A0YhuM70C7Vm9Vyx+xYwd/WOTEr8nUJcbPSR/XL+/26+rirY6jJQA==", - "dev": true, - "requires": { - "@types/node": ">= 8" - } - }, - "@types/node": { - "version": "13.1.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.1.8.tgz", - "integrity": "sha512-6XzyyNM9EKQW4HKuzbo/CkOIjn/evtCmsU+MUM1xDfJ+3/rNjBttM1NgN7AOQvN6tP1Sl1D1PIKMreTArnxM9A==", - "dev": true - }, - "atob-lite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", - "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=", - "dev": true - }, - "before-after-hook": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", - "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==", - "dev": true - }, - "btoa-lite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", - "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=", - "dev": true - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-plain-object": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz", - "integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==", - "dev": true, - "requires": { - "isobject": "^4.0.0" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz", - "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==", - "dev": true - }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", - "dev": true - }, - "lodash.set": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", - "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=", - "dev": true - }, - "lodash.uniq": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", - "dev": true - }, - "macos-release": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz", - "integrity": "sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==", - "dev": true - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "octokit-pagination-methods": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", - "integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os-name": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", - "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", - "dev": true, - "requires": { - "macos-release": "^2.2.0", - "windows-release": "^3.1.0" - } - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true - }, - "tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "dev": true - }, - "universal-user-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz", - "integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==", - "dev": true, - "requires": { - "os-name": "^3.1.0" - } - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", - "dev": true - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "dev": true, - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "windows-release": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz", - "integrity": "sha512-QTlz2hKLrdqukrsapKsINzqMgOUpQW268eJ0OaOpJN32h272waxR9fkB9VoWRtK7uKHG5EHJcTXQBD8XZVJkFA==", - "dev": true, - "requires": { - "execa": "^1.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - } - } -} diff --git a/ci/perf-tester/package.json b/ci/perf-tester/package.json deleted file mode 100644 index 7a00de44d..000000000 --- a/ci/perf-tester/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "private": true, - "main": "src/index.js", - "devDependencies": { - "@actions/core": "^1.9.1", - "@actions/exec": "^1.0.3", - "@actions/github": "^2.0.1" - } -} diff --git a/ci/perf-tester/src/index.js b/ci/perf-tester/src/index.js deleted file mode 100644 index 6dd4a5e61..000000000 --- a/ci/perf-tester/src/index.js +++ /dev/null @@ -1,212 +0,0 @@ -/* -Adapted from preactjs/compressed-size-action, which is available under this license: - -MIT License -Copyright (c) 2020 Preact -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -const { setFailed, startGroup, endGroup, debug } = require("@actions/core"); -const { GitHub, context } = require("@actions/github"); -const { exec } = require("@actions/exec"); -const { - config, - runBenchmark, - averageBenchmarks, - toDiff, - diffTable, -} = require("./utils.js"); - -const benchmarkParallel = 4; -const benchmarkSerial = 4; -const runBenchmarks = async () => { - let results = []; - for (let i = 0; i < benchmarkSerial; i++) { - results = results.concat( - await Promise.all(Array(benchmarkParallel).fill().map(runBenchmark)) - ); - } - return averageBenchmarks(results); -}; - -const perfActionComment = - ""; - -async function run(octokit, context) { - const { number: pull_number } = context.issue; - - const pr = context.payload.pull_request; - try { - debug("pr" + JSON.stringify(pr, null, 2)); - } catch (e) {} - if (!pr) { - throw Error( - 'Could not retrieve PR information. Only "pull_request" triggered workflows are currently supported.' - ); - } - - console.log( - `PR #${pull_number} is targeted at ${pr.base.ref} (${pr.base.sha})` - ); - - startGroup(`[current] Build using '${config.buildScript}'`); - await exec(config.buildScript); - endGroup(); - - startGroup(`[current] Running benchmark`); - const newBenchmarks = await runBenchmarks(); - endGroup(); - - startGroup(`[base] Checkout target branch`); - let baseRef; - try { - baseRef = context.payload.base.ref; - if (!baseRef) - throw Error("missing context.payload.pull_request.base.ref"); - await exec( - `git fetch -n origin ${context.payload.pull_request.base.ref}` - ); - console.log("successfully fetched base.ref"); - } catch (e) { - console.log("fetching base.ref failed", e.message); - try { - await exec(`git fetch -n origin ${pr.base.sha}`); - console.log("successfully fetched base.sha"); - } catch (e) { - console.log("fetching base.sha failed", e.message); - try { - await exec(`git fetch -n`); - } catch (e) { - console.log("fetch failed", e.message); - } - } - } - - console.log("checking out and building base commit"); - try { - if (!baseRef) throw Error("missing context.payload.base.ref"); - await exec(`git reset --hard ${baseRef}`); - } catch (e) { - await exec(`git reset --hard ${pr.base.sha}`); - } - endGroup(); - - startGroup(`[base] Build using '${config.buildScript}'`); - await exec(config.buildScript); - endGroup(); - - startGroup(`[base] Running benchmark`); - const oldBenchmarks = await runBenchmarks(); - endGroup(); - - const diff = toDiff(oldBenchmarks, newBenchmarks); - - const markdownDiff = diffTable(diff, { - collapseUnchanged: true, - omitUnchanged: false, - showTotal: true, - minimumChangeThreshold: config.minimumChangeThreshold, - }); - - let outputRawMarkdown = false; - - const commentInfo = { - ...context.repo, - issue_number: pull_number, - }; - - const comment = { - ...commentInfo, - body: markdownDiff + "\n\n" + perfActionComment, - }; - - startGroup(`Updating stats PR comment`); - let commentId; - try { - const comments = (await octokit.issues.listComments(commentInfo)).data; - for (let i = comments.length; i--; ) { - const c = comments[i]; - if (c.user.type === "Bot" && c.body.includes(perfActionComment)) { - commentId = c.id; - break; - } - } - } catch (e) { - console.log("Error checking for previous comments: " + e.message); - } - - if (commentId) { - console.log(`Updating previous comment #${commentId}`); - try { - await octokit.issues.updateComment({ - ...context.repo, - comment_id: commentId, - body: comment.body, - }); - } catch (e) { - console.log("Error editing previous comment: " + e.message); - commentId = null; - } - } - - // no previous or edit failed - if (!commentId) { - console.log("Creating new comment"); - try { - await octokit.issues.createComment(comment); - } catch (e) { - console.log(`Error creating comment: ${e.message}`); - console.log(`Submitting a PR review comment instead...`); - try { - const issue = context.issue || pr; - await octokit.pulls.createReview({ - owner: issue.owner, - repo: issue.repo, - pull_number: issue.number, - event: "COMMENT", - body: comment.body, - }); - } catch (e) { - console.log("Error creating PR review."); - outputRawMarkdown = true; - } - } - endGroup(); - } - - if (outputRawMarkdown) { - console.log( - ` - Error: performance-action was unable to comment on your PR. - This can happen for PR's originating from a fork without write permissions. - You can copy the size table directly into a comment using the markdown below: - \n\n${comment.body}\n\n - `.replace(/^(\t| )+/gm, "") - ); - } - - console.log("All done!"); -} - -(async () => { - try { - const octokit = new GitHub(process.env.GITHUB_TOKEN); - await run(octokit, context); - } catch (e) { - setFailed(e.message); - } -})(); diff --git a/ci/perf-tester/src/utils.js b/ci/perf-tester/src/utils.js deleted file mode 100644 index c7ecd662b..000000000 --- a/ci/perf-tester/src/utils.js +++ /dev/null @@ -1,221 +0,0 @@ -/* -Adapted from preactjs/compressed-size-action, which is available under this license: - -MIT License -Copyright (c) 2020 Preact -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -const { exec } = require("@actions/exec"); - -const formatMS = (ms) => - `${ms.toLocaleString("en-US", { - maximumFractionDigits: 0, - })}ms`; - -const config = { - buildScript: "make bootstrap benchmark_setup", - benchmark: "make -s run_benchmark", - minimumChangeThreshold: 5, -}; -exports.config = config; - -exports.runBenchmark = async () => { - let benchmarkBuffers = []; - await exec(config.benchmark, [], { - listeners: { - stdout: (data) => benchmarkBuffers.push(data), - }, - }); - const output = Buffer.concat(benchmarkBuffers).toString("utf8"); - return parse(output); -}; - -const firstLineRe = /^Running '(.+)' \.\.\.$/; -const secondLineRe = /^done ([\d.]+) ms$/; - -function parse(benchmarkData) { - const lines = benchmarkData.trim().split("\n"); - const benchmarks = Object.create(null); - for (let i = 0; i < lines.length - 1; i += 2) { - const [, name] = firstLineRe.exec(lines[i]); - const [, time] = secondLineRe.exec(lines[i + 1]); - benchmarks[name] = Math.round(parseFloat(time)); - } - return benchmarks; -} - -exports.averageBenchmarks = (benchmarks) => { - const result = Object.create(null); - for (const key of Object.keys(benchmarks[0])) { - result[key] = - benchmarks.reduce((acc, bench) => acc + bench[key], 0) / - benchmarks.length; - } - return result; -}; - -/** - * @param {{[key: string]: number}} before - * @param {{[key: string]: number}} after - * @return {Diff[]} - */ -exports.toDiff = (before, after) => { - const names = [...new Set([...Object.keys(before), ...Object.keys(after)])]; - return names.map((name) => { - const timeBefore = before[name] || 0; - const timeAfter = after[name] || 0; - const delta = timeAfter - timeBefore; - return { name, time: timeAfter, delta }; - }); -}; - -/** - * @param {number} delta - * @param {number} difference - */ -function getDeltaText(delta, difference) { - let deltaText = (delta > 0 ? "+" : "") + formatMS(delta); - if (delta && Math.abs(delta) > 1) { - deltaText += ` (${Math.abs(difference)}%)`; - } - return deltaText; -} - -/** - * @param {number} difference - */ -function iconForDifference(difference) { - let icon = ""; - if (difference >= 50) icon = "🆘"; - else if (difference >= 20) icon = "🚨"; - else if (difference >= 10) icon = "⚠️"; - else if (difference >= 5) icon = "🔍"; - else if (difference <= -50) icon = "🏆"; - else if (difference <= -20) icon = "🎉"; - else if (difference <= -10) icon = "👏"; - else if (difference <= -5) icon = "✅"; - return icon; -} - -/** - * Create a Markdown table from text rows - * @param {string[]} rows - */ -function markdownTable(rows) { - if (rows.length == 0) { - return ""; - } - - // Skip all empty columns - while (rows.every((columns) => !columns[columns.length - 1])) { - for (const columns of rows) { - columns.pop(); - } - } - - const [firstRow] = rows; - const columnLength = firstRow.length; - if (columnLength === 0) { - return ""; - } - - return [ - // Header - ["Test name", "Duration", "Change", ""].slice(0, columnLength), - // Align - [":---", ":---:", ":---:", ":---:"].slice(0, columnLength), - // Body - ...rows, - ] - .map((columns) => `| ${columns.join(" | ")} |`) - .join("\n"); -} - -/** - * @typedef {Object} Diff - * @property {string} name - * @property {number} time - * @property {number} delta - */ - -/** - * Create a Markdown table showing diff data - * @param {Diff[]} tests - * @param {object} options - * @param {boolean} [options.showTotal] - * @param {boolean} [options.collapseUnchanged] - * @param {boolean} [options.omitUnchanged] - * @param {number} [options.minimumChangeThreshold] - */ -exports.diffTable = ( - tests, - { showTotal, collapseUnchanged, omitUnchanged, minimumChangeThreshold } -) => { - let changedRows = []; - let unChangedRows = []; - let baselineRows = []; - - let totalTime = 0; - let totalDelta = 0; - for (const file of tests) { - const { name, time, delta } = file; - totalTime += time; - totalDelta += delta; - - const difference = ((delta / time) * 100) | 0; - const isUnchanged = Math.abs(difference) < minimumChangeThreshold; - - if (isUnchanged && omitUnchanged) continue; - - const columns = [ - name, - formatMS(time), - getDeltaText(delta, difference), - iconForDifference(difference), - ]; - if (name.includes('directly')) { - baselineRows.push(columns); - } else if (isUnchanged && collapseUnchanged) { - unChangedRows.push(columns); - } else { - changedRows.push(columns); - } - } - - let out = markdownTable(changedRows); - - if (unChangedRows.length !== 0) { - const outUnchanged = markdownTable(unChangedRows); - out += `\n\n
View Unchanged\n\n${outUnchanged}\n\n
\n\n`; - } - - if (baselineRows.length !== 0) { - const outBaseline = markdownTable(baselineRows.map(line => line.slice(0, 2))); - out += `\n\n
View Baselines\n\n${outBaseline}\n\n
\n\n`; - } - - if (showTotal) { - const totalDifference = ((totalDelta / totalTime) * 100) | 0; - let totalDeltaText = getDeltaText(totalDelta, totalDifference); - let totalIcon = iconForDifference(totalDifference); - out = `**Total Time:** ${formatMS(totalTime)}\n\n${out}`; - out = `**Time Change:** ${totalDeltaText} ${totalIcon}\n\n${out}`; - } - - return out; -};