From a71f81f57ab953fa050be9a579f4d0374d022474 Mon Sep 17 00:00:00 2001 From: Ahmed Ihab <57008633+ahmedihabb2@users.noreply.github.com> Date: Fri, 30 Jun 2023 23:15:09 +0300 Subject: [PATCH] Some improvements to macOS CI (#446) * SSH intro runner [skip ci] * Fix cobol paths [skip ci] * SSH to try commands [skip ci] * Enable C [skip ci] * Debugging [skip ci] * Fix tcc paths [skip ci] * Fix typo * more debugging [skip ci] * Add libclang paths [skip ci] * Remove Tcc installation [skip ci] * fix Tcc installation [skip ci] * Avoid assuming bash in python [skip ci] * Avoid assuming bash in ruby [skip ci] * Avoid assuming bash in ruby [skip ci] * SSH [skip ci] * Fix java path [skip ci] * Fix java path [skip ci] * Fix java path [skip ci] * Avoid assuming bash [skip ci] * Avoid assuming bash [skip ci] * Avoid assuming bash [skip ci] * SSH [skip ci] * Avoid assuming bash [skip ci] * Try to fix jni [skip ci] * Try fixing java paths [skip ci] * Try fixing java paths [skip ci] * Final touch * Revert C changes * Update macos-test.yml --------- Co-authored-by: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> --- .github/workflows/macos-test.yml | 15 ++++++++++++--- tools/metacall-environment.sh | 26 +++++++++++++++----------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/.github/workflows/macos-test.yml b/.github/workflows/macos-test.yml index 4e9772b2e..b34b94858 100644 --- a/.github/workflows/macos-test.yml +++ b/.github/workflows/macos-test.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - options: [ + options: [ {build: debug, sanitizer: without-sanitizer}, {build: debug, sanitizer: address-sanitizer}, {build: debug, sanitizer: thread-sanitizer}, @@ -53,22 +53,31 @@ jobs: RUBY_FRAMEWORK_DIR=$(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/Ruby.framework sudo rm -rf $RUBY_FRAMEWORK_DIR + - name: Uninstall Java + run: | + sudo rm -rf /Library/Java/JavaVirtualMachines/* + sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin + sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane + unset JAVA_HOME + - name: Set up the environment run: sh ./tools/metacall-environment.sh $METACALL_INSTALL_OPTIONS env: - METACALL_INSTALL_OPTIONS: base python nodejs typescript java ruby wasm rpc file cobol #netcore5 c rust rapidjson funchook swig pack # clangformat v8rep51 coverage + METACALL_INSTALL_OPTIONS: base python nodejs typescript java ruby wasm rpc file cobol #netcore5 rust rapidjson funchook swig pack # clangformat v8rep51 coverage - name: Configure run: | cd build + . .env bash ../tools/metacall-configure.sh $METACALL_CONFIGURE_OPTIONS env: - METACALL_CONFIGURE_OPTIONS: ${{ matrix.options.build }} ${{ matrix.options.sanitizer }} scripts ports tests sanitizer python nodejs typescript java ruby wasm rpc file cobol # netcore5 c rust examples install pack benchmarks # v8 coverage + METACALL_CONFIGURE_OPTIONS: ${{ matrix.options.build }} ${{ matrix.options.sanitizer }} scripts ports tests python nodejs typescript java ruby wasm rpc file cobol benchmarks install # netcore5 c rust examples pack # v8 coverage - name: Build working-directory: ./build # TODO: Remove the disable option for fork safe once funchook problem is solved run: | + . .env cmake -DOPTION_FORK_SAFE=OFF .. bash ../tools/metacall-build.sh $METACALL_BUILD_OPTIONS env: diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index 575f8b17b..8585f91b5 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -183,13 +183,13 @@ sub_python(){ pyenv install 3.11.1 pyenv global 3.11.1 pyenv rehash - - # TODO: Avoid this, do no asume bash, find a better way to deal with environment variables - echo -e '\nif command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile - source ~/.bash_profile - mkdir -p build CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" + ENV_FILE="$ROOT_DIR/build/.env" + + echo eval "$(pyenv init -)" >> $ENV_FILE + . $ENV_FILE + echo "-DPython3_INCLUDE_DIRS=$HOME/.pyenv/versions/3.11.1/include/python3.11" >> $CMAKE_CONFIG_PATH echo "-DPython3_LIBRARY=$HOME/.pyenv/versions/3.11.1/lib/libpython3.11.dylib" >> $CMAKE_CONFIG_PATH echo "-DPython3_EXECUTABLE=$HOME/.pyenv/versions/3.11.1/bin/python3.11" >> $CMAKE_CONFIG_PATH @@ -226,11 +226,7 @@ sub_ruby(){ fi elif [ "${OPERATIVE_SYSTEM}" = "Darwin" ]; then brew install ruby@3.2 - - # TODO: Avoid this, do no asume bash, find a better way to deal with environment variables - echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile - source ~/.bash_profile - + brew link ruby@3.2 --force --overwrite mkdir -p build CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" RUBY_PREFIX="$(brew --prefix ruby@3.2)" @@ -238,7 +234,7 @@ sub_ruby(){ echo "-DRuby_INCLUDE_DIR=$RUBY_PREFIX/include/ruby-3.2.0" >> $CMAKE_CONFIG_PATH echo "-DRuby_LIBRARY=$RUBY_PREFIX/lib/libruby.3.2.dylib" >> $CMAKE_CONFIG_PATH echo "-DRuby_EXECUTABLE=$RUBY_PREFIX/bin/ruby" >> $CMAKE_CONFIG_PATH - echo "-DRuby_VERSION_STRING=$RUBY_VERSION" >> $CMAKE_CONFIG_PATH + echo "-DRuby_VERSION=$RUBY_VERSION" >> $CMAKE_CONFIG_PATH fi } @@ -572,6 +568,14 @@ sub_java(){ fi elif [ "${OPERATIVE_SYSTEM}" = "Darwin" ]; then brew install openjdk@17 + sudo ln -sfn $(brew --prefix openjdk@17)/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk + JAVA_PREFIX=$(/usr/libexec/java_home -v 17) + mkdir -p build + CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" + echo "-DJAVA_HOME=$JAVA_PREFIX" >> $CMAKE_CONFIG_PATH + echo "-DJAVA_INCLUDE_PATH=$JAVA_PREFIX/include" >> $CMAKE_CONFIG_PATH + echo "-DJAVA_INCLUDE_PATH2=$JAVA_PREFIX/include/darwin" >> $CMAKE_CONFIG_PATH + echo "-DJAVA_AWT_INCLUDE_PATH=$JAVA_PREFIX/include" >> $CMAKE_CONFIG_PATH fi }