Skip to content

Commit 8d3db3e

Browse files
Made lots of syntactical fixes and added Ruby's submodule (Ruby still not enabled, in progress) (#339)
* Write a starter environment script in PowerShell Signed-off-by: Param Siddharth <[email protected]> * Add test for Windows; Temporarily disable Linux tests Signed-off-by: Param Siddharth <[email protected]> * Update the variables Signed-off-by: Param Siddharth <[email protected]> * Mark variables as global Signed-off-by: Param Siddharth <[email protected]> * Make all variables global Signed-off-by: Param Siddharth <[email protected]> * Fix the usage of args Signed-off-by: Param Siddharth <[email protected]> * Replace apt with choco Signed-off-by: Param Siddharth <[email protected]> * Add code for Python Signed-off-by: Param Siddharth <[email protected]> * Debug environment Signed-off-by: Param Siddharth <[email protected]> * Assign to global variables Signed-off-by: Param Siddharth <[email protected]> * Path issue fix Signed-off-by: Param Siddharth <[email protected]> * Use original Python binary Signed-off-by: Param Siddharth <[email protected]> * Update script to use existing Windows CI code Signed-off-by: Param Siddharth <[email protected]> * Clarify when replacing Python Signed-off-by: Param Siddharth <[email protected]> * Check for exit code correctly (pwsh) Signed-off-by: Param Siddharth <[email protected]> * Save path differently Signed-off-by: Param Siddharth <[email protected]> * Modify PATH variable using GITHUB_PATH Signed-off-by: Param Siddharth <[email protected]> * Add runtime path to the beginning of PATH Signed-off-by: Param Siddharth <[email protected]> * Use variable for new PATH Signed-off-by: Param Siddharth <[email protected]> * Write configuration script Signed-off-by: Param Siddharth <[email protected]> * Update workflow with configuration script for Windows Signed-off-by: Param Siddharth <[email protected]> * Update function syntax for `sub-configure` Signed-off-by: Param Siddharth <[email protected]> * Fix variable name in workflow Signed-off-by: Param Siddharth <[email protected]> * Fix multiline breaking of commands, Go to build directory Signed-off-by: Param Siddharth <[email protected]> * Concatenate strings correctly Signed-off-by: Param Siddharth <[email protected]> * Create and navigate to build dir from the workflow itself Signed-off-by: Param Siddharth <[email protected]> * Uncomment `FindPython` patch Signed-off-by: Param Siddharth <[email protected]> * Show `FindPython.cmake` path and contents Signed-off-by: Param Siddharth <[email protected]> * Display errorlevel at the end Signed-off-by: Param Siddharth <[email protected]> * Upload FindPython.cmake for debugging Signed-off-by: Param Siddharth <[email protected]> * Remove accidental uncomment Signed-off-by: Param Siddharth <[email protected]> * Fix command error Signed-off-by: Param Siddharth <[email protected]> * Use `curl.exe` Signed-off-by: Param Siddharth <[email protected]> * Set default encoding Signed-off-by: Param Siddharth <[email protected]> * Remove debug statements (for `FindPython.cmake`) Signed-off-by: Param Siddharth <[email protected]> * Return with last exit code in configuration script Signed-off-by: Param Siddharth <[email protected]> * Create separate method to add to PATH Signed-off-by: Param Siddharth <[email protected]> * Add build step Signed-off-by: Param Siddharth <[email protected]> * Remove target argument from build step Signed-off-by: Param Siddharth <[email protected]> * Collect logs for `funchook` failure Signed-off-by: Param Siddharth <[email protected]> * Remove log upload, Disable fork safe build Signed-off-by: Param Siddharth <[email protected]> * Print build string before building Signed-off-by: Param Siddharth <[email protected]> * Include debug and symbols in Python installation Signed-off-by: Param Siddharth <[email protected]> * Include debug library in Python Signed-off-by: Param Siddharth <[email protected]> * Fix multiline bug Signed-off-by: Param Siddharth <[email protected]> * Refresh env after adding to PATH Signed-off-by: Param Siddharth <[email protected]> * Write a separate script for building Signed-off-by: Param Siddharth <[email protected]> * Run tests using CTest Signed-off-by: Param Siddharth <[email protected]> * Fix improper merge Signed-off-by: Param Siddharth <[email protected]> * Add newlines wherever needed Signed-off-by: Param Siddharth <[email protected]> * Add Node environment setup Signed-off-by: Param Siddharth <[email protected]> * Update workflow to set up Node Signed-off-by: Param Siddharth <[email protected]> * Remove NASM from configuration setup and add it to environment setup Signed-off-by: Param Siddharth <[email protected]> * Make dependency directory Signed-off-by: Param Siddharth <[email protected]> * Debug: Show directories Signed-off-by: Param Siddharth <[email protected]> * Debug: Show more info Signed-off-by: Param Siddharth <[email protected]> * Debug: Call GNU utils Signed-off-by: Param Siddharth <[email protected]> * Debug: ??? Signed-off-by: Param Siddharth <[email protected]> * Debug: Show parent directory Signed-off-by: Param Siddharth <[email protected]> * Remove commented out code Signed-off-by: Param Siddharth <[email protected]> * Remove './' from web client Signed-off-by: Param Siddharth <[email protected]> * Dowmload to explicit path Signed-off-by: Param Siddharth <[email protected]> * Use explicit download paths (why?) Signed-off-by: Param Siddharth <[email protected]> * Remove debug statements Signed-off-by: Param Siddharth <[email protected]> * Remove invalid parameter Signed-off-by: Param Siddharth <[email protected]> * Keep the Node DLL in the right location Signed-off-by: Param Siddharth <[email protected]> * Add Ruby installation function Signed-off-by: Param Siddharth <[email protected]> * Add Ruby to configuration and build Signed-off-by: Param Siddharth <[email protected]> * Enable scripts and tests Signed-off-by: Param Siddharth <[email protected]> * Explicitly generate NMake Makefiles Signed-off-by: Param Siddharth <[email protected]> * Syntactical fix Signed-off-by: Param Siddharth <[email protected]> * Generate no NMake Makefiles Signed-off-by: Param Siddharth <[email protected]> * Fix "else" syntax error Signed-off-by: Param Siddharth <[email protected]> * Avoid copying to the lib directory Signed-off-by: Param Siddharth <[email protected]> * Add comment to add prerequisites Signed-off-by: Param Siddharth <[email protected]> * Temporarily disable Ruby, tests, and scripts Signed-off-by: Param Siddharth <[email protected]> * Revert "Temporarily disable Ruby, tests, and scripts" This reverts commit a7083d0. * Modify CI params temporarily Signed-off-by: Param Siddharth <[email protected]> * Copy DLL Signed-off-by: Param Siddharth <[email protected]> * Build tests Signed-off-by: Param Siddharth <[email protected]> * Fix workflow Signed-off-by: Param Siddharth <[email protected]> * Add more flags in configuration Signed-off-by: Param Siddharth <[email protected]> * Fix path string error Signed-off-by: Param Siddharth <[email protected]> * Debug path Signed-off-by: Param Siddharth <[email protected]> * Fix path location Signed-off-by: Param Siddharth <[email protected]> * Exclude DNPM_ROOT Signed-off-by: Param Siddharth <[email protected]> * Copy libraries after build and before test Signed-off-by: Param Siddharth <[email protected]> * Display that files are being copied Signed-off-by: Param Siddharth <[email protected]> * Temporarily print file name Signed-off-by: Param Siddharth <[email protected]> * List contents of lib dir for NodeJS Signed-off-by: Param Siddharth <[email protected]> * Use job-level env vars Signed-off-by: Param Siddharth <[email protected]> * Enable Linux tests Signed-off-by: Param Siddharth <[email protected]> * Revert "Enable Linux tests" This reverts commit a7ecf17. * Hide files, Remove debug statements Signed-off-by: Param Siddharth <[email protected]> Signed-off-by: Param Siddharth <[email protected]>
1 parent d518494 commit 8d3db3e

File tree

4 files changed

+83
-34
lines changed

4 files changed

+83
-34
lines changed

.github/workflows/test.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ jobs:
1212
strategy:
1313
matrix:
1414
buildtype: [debug, release]
15+
16+
env:
17+
DEBIAN_FRONTEND: noninteractive
18+
LTTNG_UST_REGISTER_TIMEOUT: 0
19+
NUGET_XMLDOC_MODE: skip
20+
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
21+
1522
steps:
1623
- name: Check out the repository
1724
uses: actions/checkout@v2
@@ -40,10 +47,6 @@ jobs:
4047
- name: Set up the environment
4148
run: sudo ./tools/metacall-environment.sh ${METACALL_INSTALL_OPTIONS}
4249
env:
43-
DEBIAN_FRONTEND: noninteractive
44-
LTTNG_UST_REGISTER_TIMEOUT: 0
45-
NUGET_XMLDOC_MODE: skip
46-
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
4750
METACALL_INSTALL_OPTIONS: root base python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust rapidjson funchook swig pack backtrace
4851

4952
- name: Configure
@@ -59,10 +62,6 @@ jobs:
5962
cd build
6063
sudo "${METACALL_PATH}/tools/metacall-configure.sh" ${METACALL_BUILD_TYPE} ${METACALL_BUILD_OPTIONS}
6164
env:
62-
DEBIAN_FRONTEND: noninteractive
63-
LTTNG_UST_REGISTER_TIMEOUT: 0
64-
NUGET_XMLDOC_MODE: skip
65-
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
6665
NODE_PATH: /usr/lib/node_modules
6766
METACALL_BUILD_TYPE: ${{ matrix.buildtype }}
6867
METACALL_BUILD_OPTIONS: root python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust examples tests scripts ports dynamic install pack benchmarks
@@ -79,17 +78,19 @@ jobs:
7978
cd build
8079
sudo "${METACALL_PATH}/tools/metacall-build.sh" ${METACALL_BUILD_TYPE} ${METACALL_BUILD_OPTIONS}
8180
env:
82-
DEBIAN_FRONTEND: noninteractive
83-
LTTNG_UST_REGISTER_TIMEOUT: 0
84-
NUGET_XMLDOC_MODE: skip
85-
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
8681
NODE_PATH: /usr/lib/node_modules
8782
METACALL_BUILD_TYPE: ${{ matrix.buildtype }}
8883
METACALL_BUILD_OPTIONS: root python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust examples tests scripts ports dynamic install pack benchmarks
8984

9085
windows-test:
9186
name: Windows MSVC Test
9287
runs-on: windows-latest
88+
89+
env:
90+
LTTNG_UST_REGISTER_TIMEOUT: 0
91+
NUGET_XMLDOC_MODE: skip
92+
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
93+
9394
steps:
9495
- name: Check out the repository
9596
uses: actions/checkout@v2
@@ -99,10 +100,7 @@ jobs:
99100
- name: Set up the environment
100101
run: cmd.exe /c "powershell .\tools\metacall-environment.ps1 $Env:METACALL_INSTALL_OPTIONS"
101102
env:
102-
LTTNG_UST_REGISTER_TIMEOUT: 0
103-
NUGET_XMLDOC_MODE: skip
104-
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
105-
METACALL_INSTALL_OPTIONS: base python nodejs nasm # ruby netcore5 typescript file rpc wasm java c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage
103+
METACALL_INSTALL_OPTIONS: base python nodejs nasm # ruby # netcore5 typescript file rpc wasm java c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage
106104

107105
- name: Run the configuration script
108106
run: |
@@ -111,18 +109,12 @@ jobs:
111109
cd "$METACALL_PATH\build"
112110
cmd.exe /c "powershell ..\tools\metacall-configure.ps1 $Env:METACALL_BUILD_TYPE $Env:METACALL_BUILD_OPTIONS"
113111
env:
114-
LTTNG_UST_REGISTER_TIMEOUT: 0
115-
NUGET_XMLDOC_MODE: skip
116-
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
117112
METACALL_BUILD_TYPE: debug
118-
METACALL_BUILD_OPTIONS: python nodejs # root ruby netcore5 typescript file rpc wasm java c cobol rust examples tests scripts ports dynamic install pack benchmarks # sanitizer v8 coverage
113+
METACALL_BUILD_OPTIONS: python nodejs tests scripts ports # ruby # root netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # sanitizer v8 coverage
119114

120115
- name: Build the core
121116
working-directory: ./build
122117
run: cmd.exe /c "powershell ..\tools\metacall-build.ps1 $Env:METACALL_BUILD_TYPE $Env:METACALL_BUILD_OPTIONS"
123118
env:
124-
LTTNG_UST_REGISTER_TIMEOUT: 0
125-
NUGET_XMLDOC_MODE: skip
126-
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
127119
METACALL_BUILD_TYPE: debug
128120
METACALL_BUILD_OPTIONS: tests # coverage install

tools/metacall-build.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ function sub-build {
4545
# Tests (coverage needs to run the tests)
4646
if ( ($BUILD_TESTS -eq 1) -or ($BUILD_COVERAGE -eq 1) ) {
4747
echo "Running the tests..."
48+
49+
# Prerequisites
50+
$files = @(
51+
"..\runtimes\nodejs\lib\libnode.dll",
52+
"..\runtimes\nodejs\lib\libnode.lib"
53+
)
54+
55+
ForEach ($file in $files) {
56+
if ( (Test-Path $file -PathType Leaf) ) {
57+
echo "Copying ""$file"" to "".\$BUILD_TYPE\""..."
58+
cp $file ".\$BUILD_TYPE\"
59+
}
60+
}
61+
4862
ctest "-j$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors)" --output-on-failure -C $BUILD_TYPE
4963
}
5064

tools/metacall-configure.ps1

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function sub-configure {
141141
# Scripts
142142
if ( $BUILD_SCRIPTS -eq 1 ) {
143143
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_SCRIPTS=On"
144-
else
144+
} else {
145145
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_SCRIPTS=Off"
146146
}
147147

@@ -233,6 +233,14 @@ function sub-configure {
233233
if ( $BUILD_NODEJS -eq 1 ) {
234234
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_LOADERS_NODE=On"
235235

236+
<# & {
237+
cd ..
238+
$NodePath = "$($(pwd).Path.Replace('\', '/'))/runtimes/nodejs"
239+
echo "NODE PATH LALALALALALALALALALA: $NodePath"
240+
ls $NodePath
241+
$Global:BUILD_STRING = "$BUILD_STRING ""-DNPM_ROOT=$NodePath"""
242+
} #>
243+
236244
if ( $BUILD_SCRIPTS -eq 1 ) {
237245
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_SCRIPTS_NODE=On"
238246
}
@@ -312,42 +320,44 @@ function sub-configure {
312320
# Examples
313321
if ( $BUILD_EXAMPLES -eq 1 ) {
314322
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_EXAMPLES=On"
315-
else
323+
} else {
316324
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_EXAMPLES=Off"
317325
}
318326

319327
# Tests
320328
if ( $BUILD_TESTS -eq 1 ) {
321329
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_TESTS=On"
322-
else
330+
} else {
323331
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_TESTS=Off"
324332
}
325333

326334
# Benchmarks
327335
if ( $BUILD_BENCHMARKS -eq 1 ) {
328336
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_BENCHMARKS=On"
329-
else
337+
} else {
330338
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_BENCHMARKS=Off"
331339
}
332340

333341
# Ports
334342
if ( $BUILD_PORTS -eq 1 ) {
335343
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_PORTS=On"
336-
else
344+
} else {
337345
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_PORTS=Off"
338346
}
339347

340348
# Coverage
341349
if ( $BUILD_COVERAGE -eq 1 ) {
342350
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_COVERAGE=On"
343-
else
351+
} else {
344352
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_COVERAGE=Off"
345353
}
346354

347355
# Sanitizer
348356
if ( $BUILD_SANITIZER -eq 1 ) {
349-
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_SANITIZER=On"
350-
else
357+
# Disable backtrace module when sanitizer is enabled
358+
# in order to let the sanitizer catch the segmentation faults
359+
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_SANITIZER=On" # -DOPTION_BUILD_BACKTRACE=Off
360+
} else {
351361
$Global:BUILD_STRING = "$BUILD_STRING -DOPTION_BUILD_SANITIZER=Off"
352362
}
353363

@@ -369,8 +379,9 @@ function sub-configure {
369379

370380
# Execute CMake
371381
# cmd.exe /c "cmake -Wno-dev -DOPTION_GIT_HOOKS=Off $BUILD_STRING .."
372-
echo "BUILD COMMAND: cmake -DOPTION_FORK_SAFE=OFF $BUILD_STRING .."
373-
cmd.exe /c "cmake -DOPTION_FORK_SAFE=OFF $BUILD_STRING .."
382+
$CustomFlags = '-DOPTION_BUILD_SECURITY=OFF -DOPTION_FORK_SAFE=OFF'
383+
echo "BUILD COMMAND: cmake $CustomFlags $BUILD_STRING .."
384+
cmd.exe /c "cmake $CustomFlags $BUILD_STRING .."
374385

375386
Exit $LASTEXITCODE
376387
}

tools/metacall-environment.ps1

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,41 @@ function sub-python {
122122
function sub-ruby {
123123
echo "configure ruby"
124124
cd $ROOT_DIR
125+
126+
$DepsDir = "$ROOT_DIR\dependencies"
127+
$RubyDownloadVersion = '3.1.2'
128+
$RubyVersion = '3.1.0'
129+
$RuntimeDir = "$ROOT_DIR\runtimes\ruby"
130+
131+
md -Force $DepsDir
132+
md -Force $RuntimeDir
133+
cd $DepsDir
134+
135+
# Download
136+
(New-Object Net.WebClient).DownloadFile("https://github.com/MSP-Greg/ruby-mswin/releases/download/ruby-mswin-builds/Ruby-$RubyDownloadVersion-ms.7z", "$(pwd)\ruby-mswin.7z")
137+
138+
# Install Ruby
139+
7z x "$DepsDir\ruby-mswin.7z"
140+
robocopy /move /e "$DepsDir\Ruby31-ms" $RuntimeDir /NFL /NDL /NJH /NJS /NC /NS /NP
141+
142+
Add-to-Path "$RuntimeDir\bin"
125143

126-
# TODO (copied from metacall-environment.sh): Review conflict with NodeJS (currently rails test is disabled)
144+
# Patch for FindRuby.cmake
145+
$FindRuby = "$ROOT_DIR\cmake\FindRuby.cmake"
146+
$RubyRuntimeDir = $RuntimeDir.Replace('\', '/')
147+
148+
echo "set(Ruby_VERSION $RubyVersion)" > $FindRuby
149+
echo "set(Ruby_ROOT_DIR ""$RubyRuntimeDir"")" >> $FindRuby
150+
echo "set(Ruby_EXECUTABLE ""$RubyRuntimeDir/bin/ruby.exe"")" >> $FindRuby
151+
echo "set(Ruby_INCLUDE_DIRS ""$RubyRuntimeDir/include/ruby-$RubyVersion;$RubyRuntimeDir/include/ruby-$RubyVersion/x64-mswin64_140"")" >> $FindRuby
152+
echo "set(Ruby_LIBRARY ""$RubyRuntimeDir/lib/x64-vcruntime140-ruby310.lib"")" >> $FindRuby
153+
echo "include(FindPackageHandleStandardArgs)" >> $FindRuby
154+
echo "FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby REQUIRED_VARS Ruby_EXECUTABLE Ruby_LIBRARY Ruby_INCLUDE_DIRS VERSION_VAR Ruby_VERSION)" >> $FindRuby
155+
echo "mark_as_advanced(Ruby_EXECUTABLE Ruby_LIBRARY Ruby_INCLUDE_DIRS)" >> $FindRuby
127156

157+
# Move DLL to correct location (to be done AFTER build)
158+
# mv -Force "$RuntimeDir\bin\x64-vcruntime140-ruby310.dll" "$ROOT_DIR\lib"
159+
cp -Force "$RuntimeDir\bin\x64-vcruntime140-ruby310.dll" "$ROOT_DIR\lib"
128160
}
129161

130162
# Rust

0 commit comments

Comments
 (0)