Skip to content

Commit

Permalink
Test Job (with Python) for Windows in the CI Workflow (#329)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
paramsiddharth authored Sep 1, 2022
1 parent 3430435 commit 16eb9f1
Show file tree
Hide file tree
Showing 4 changed files with 1,084 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
linux-test:
name: Linux (Ubuntu) GCC Test
runs-on: ubuntu-latest
if: github.repository == 'metacall/core'
strategy:
matrix:
buildtype: [debug, release]
Expand Down Expand Up @@ -85,3 +86,43 @@ jobs:
NODE_PATH: /usr/lib/node_modules
METACALL_BUILD_TYPE: ${{ matrix.buildtype }}
METACALL_BUILD_OPTIONS: root python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust examples tests scripts ports dynamic install pack benchmarks

windows-test:
name: Windows MSVC Test
runs-on: windows-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up the environment
run: cmd.exe /c "powershell .\tools\metacall-environment.ps1 $Env:METACALL_INSTALL_OPTIONS"
env:
LTTNG_UST_REGISTER_TIMEOUT: 0
NUGET_XMLDOC_MODE: skip
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
METACALL_INSTALL_OPTIONS: base python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage

- name: Run the configuration script
run: |
$METACALL_PATH = $PWD
md -Force "$METACALL_PATH\build"
cd "$METACALL_PATH\build"
cmd.exe /c "powershell ..\tools\metacall-configure.ps1 $Env:METACALL_BUILD_TYPE $Env:METACALL_BUILD_OPTIONS"
env:
LTTNG_UST_REGISTER_TIMEOUT: 0
NUGET_XMLDOC_MODE: skip
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
METACALL_BUILD_TYPE: debug
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

- name: Build the core
working-directory: ./build
run: cmd.exe /c "powershell ..\tools\metacall-build.ps1 $Env:METACALL_BUILD_TYPE $Env:METACALL_BUILD_OPTIONS"
env:
LTTNG_UST_REGISTER_TIMEOUT: 0
NUGET_XMLDOC_MODE: skip
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
METACALL_BUILD_TYPE: debug
METACALL_BUILD_OPTIONS: tests # coverage install
87 changes: 87 additions & 0 deletions tools/metacall-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
$Global:BUILD_TYPE = 'Release'
$Global:BUILD_TESTS = 0
$Global:BUILD_COVERAGE = 0
$Global:BUILD_INSTALL = 0

$Global:PROGNAME = $(Get-Item $PSCommandPath).Basename
$Global:Arguments = $args

function sub-options {
for ($i = 0; $i -lt $Arguments.Length; $i++) {
$option = $Arguments[$i]
if ( "$option" -eq "debug" ) {
echo "Build all scripts in debug mode"
$Global:BUILD_TYPE = 'Debug'
}
if ( "$option" -eq "release" ) {
echo "Build all scripts in release mode"
$Global:BUILD_TYPE = 'Release'
}
if ( "$option" -eq "relwithdebinfo" ) {
echo "Build all scripts in release mode with debug symbols"
$Global:BUILD_TYPE = 'RelWithDebInfo'
}
if ( "$option" -eq "tests" ) {
echo "Build and run all tests"
$Global:BUILD_TESTS = 1
}
if ( "$option" -eq "coverage" ) {
echo "Build coverage reports"
$Global:BUILD_COVERAGE = 1
}
if ( "$option" -eq "install" ) {
echo "Install all libraries"
$Global:BUILD_INSTALL = 1
}
}
}

function sub-build {

# Build the project
echo "Building MetaCall..."
cmake --build . "-j$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors)"

# Tests (coverage needs to run the tests)
if ( ($BUILD_TESTS -eq 1) -or ($BUILD_COVERAGE -eq 1) ) {
echo "Running the tests..."
ctest "-j$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors)" --output-on-failure --test-output-size-failed 3221000000 -C $BUILD_TYPE
}

# Coverage
<# if ( $BUILD_COVERAGE = 1 ) {
# TODO (copied): Remove -k, solve coverage issues
# TODO: Migrate to Windows
echo "Reporting coverage..."
make -k gcov
make -k lcov
make -k lcov-genhtml
} #>

# Install
if ( $BUILD_INSTALL -eq 1 ) {
echo "Building and installing MetaCall..."
cmake --build . --target install
}
}

function sub-help {
echo "Usage: $PROGNAME list of options"
echo "Options:"
echo " debug | release | relwithdebinfo: build type"
echo " tests: build and run all tests"
echo " coverage: build coverage reports"
echo " install: install all libraries"
echo ""
}

switch($args.length) {
0 {
sub-help
Break
}
Default {
sub-options
sub-build
}
}
Loading

0 comments on commit 16eb9f1

Please sign in to comment.