Skip to content

Commit 16eb9f1

Browse files
Test Job (with Python) for Windows in the CI Workflow (#329)
* 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]> Signed-off-by: Param Siddharth <[email protected]>
1 parent 3430435 commit 16eb9f1

File tree

4 files changed

+1084
-0
lines changed

4 files changed

+1084
-0
lines changed

.github/workflows/test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
linux-test:
99
name: Linux (Ubuntu) GCC Test
1010
runs-on: ubuntu-latest
11+
if: github.repository == 'metacall/core'
1112
strategy:
1213
matrix:
1314
buildtype: [debug, release]
@@ -85,3 +86,43 @@ jobs:
8586
NODE_PATH: /usr/lib/node_modules
8687
METACALL_BUILD_TYPE: ${{ matrix.buildtype }}
8788
METACALL_BUILD_OPTIONS: root python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust examples tests scripts ports dynamic install pack benchmarks
89+
90+
windows-test:
91+
name: Windows MSVC Test
92+
runs-on: windows-latest
93+
steps:
94+
- name: Check out the repository
95+
uses: actions/checkout@v2
96+
with:
97+
fetch-depth: 0
98+
99+
- name: Set up the environment
100+
run: cmd.exe /c "powershell .\tools\metacall-environment.ps1 $Env:METACALL_INSTALL_OPTIONS"
101+
env:
102+
LTTNG_UST_REGISTER_TIMEOUT: 0
103+
NUGET_XMLDOC_MODE: skip
104+
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
105+
METACALL_INSTALL_OPTIONS: base python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage
106+
107+
- name: Run the configuration script
108+
run: |
109+
$METACALL_PATH = $PWD
110+
md -Force "$METACALL_PATH\build"
111+
cd "$METACALL_PATH\build"
112+
cmd.exe /c "powershell ..\tools\metacall-configure.ps1 $Env:METACALL_BUILD_TYPE $Env:METACALL_BUILD_OPTIONS"
113+
env:
114+
LTTNG_UST_REGISTER_TIMEOUT: 0
115+
NUGET_XMLDOC_MODE: skip
116+
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
117+
METACALL_BUILD_TYPE: debug
118+
METACALL_BUILD_OPTIONS: python # root ruby netcore5 nodejs typescript file rpc wasm java c cobol rust examples tests scripts ports dynamic install pack benchmarks # sanitizer v8 coverage
119+
120+
- name: Build the core
121+
working-directory: ./build
122+
run: cmd.exe /c "powershell ..\tools\metacall-build.ps1 $Env:METACALL_BUILD_TYPE $Env:METACALL_BUILD_OPTIONS"
123+
env:
124+
LTTNG_UST_REGISTER_TIMEOUT: 0
125+
NUGET_XMLDOC_MODE: skip
126+
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
127+
METACALL_BUILD_TYPE: debug
128+
METACALL_BUILD_OPTIONS: tests # coverage install

tools/metacall-build.ps1

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
$Global:BUILD_TYPE = 'Release'
2+
$Global:BUILD_TESTS = 0
3+
$Global:BUILD_COVERAGE = 0
4+
$Global:BUILD_INSTALL = 0
5+
6+
$Global:PROGNAME = $(Get-Item $PSCommandPath).Basename
7+
$Global:Arguments = $args
8+
9+
function sub-options {
10+
for ($i = 0; $i -lt $Arguments.Length; $i++) {
11+
$option = $Arguments[$i]
12+
if ( "$option" -eq "debug" ) {
13+
echo "Build all scripts in debug mode"
14+
$Global:BUILD_TYPE = 'Debug'
15+
}
16+
if ( "$option" -eq "release" ) {
17+
echo "Build all scripts in release mode"
18+
$Global:BUILD_TYPE = 'Release'
19+
}
20+
if ( "$option" -eq "relwithdebinfo" ) {
21+
echo "Build all scripts in release mode with debug symbols"
22+
$Global:BUILD_TYPE = 'RelWithDebInfo'
23+
}
24+
if ( "$option" -eq "tests" ) {
25+
echo "Build and run all tests"
26+
$Global:BUILD_TESTS = 1
27+
}
28+
if ( "$option" -eq "coverage" ) {
29+
echo "Build coverage reports"
30+
$Global:BUILD_COVERAGE = 1
31+
}
32+
if ( "$option" -eq "install" ) {
33+
echo "Install all libraries"
34+
$Global:BUILD_INSTALL = 1
35+
}
36+
}
37+
}
38+
39+
function sub-build {
40+
41+
# Build the project
42+
echo "Building MetaCall..."
43+
cmake --build . "-j$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors)"
44+
45+
# Tests (coverage needs to run the tests)
46+
if ( ($BUILD_TESTS -eq 1) -or ($BUILD_COVERAGE -eq 1) ) {
47+
echo "Running the tests..."
48+
ctest "-j$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors)" --output-on-failure --test-output-size-failed 3221000000 -C $BUILD_TYPE
49+
}
50+
51+
# Coverage
52+
<# if ( $BUILD_COVERAGE = 1 ) {
53+
# TODO (copied): Remove -k, solve coverage issues
54+
# TODO: Migrate to Windows
55+
echo "Reporting coverage..."
56+
make -k gcov
57+
make -k lcov
58+
make -k lcov-genhtml
59+
} #>
60+
61+
# Install
62+
if ( $BUILD_INSTALL -eq 1 ) {
63+
echo "Building and installing MetaCall..."
64+
cmake --build . --target install
65+
}
66+
}
67+
68+
function sub-help {
69+
echo "Usage: $PROGNAME list of options"
70+
echo "Options:"
71+
echo " debug | release | relwithdebinfo: build type"
72+
echo " tests: build and run all tests"
73+
echo " coverage: build coverage reports"
74+
echo " install: install all libraries"
75+
echo ""
76+
}
77+
78+
switch($args.length) {
79+
0 {
80+
sub-help
81+
Break
82+
}
83+
Default {
84+
sub-options
85+
sub-build
86+
}
87+
}

0 commit comments

Comments
 (0)