Prepare for release v1.7.0 #299
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: '30 20 * * *' # Warning: Timezone dep - 20:00 is 1:00 | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: osx15-arm-clang-repl-20-emscripten_wasm | |
| os: macos-15 | |
| clang-runtime: '20' | |
| cling: Off | |
| micromamba_shell_init: bash | |
| emsdk_ver: "3.1.73" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Save PR Info on Unix systems | |
| if: ${{ runner.os != 'windows' }} | |
| run: | | |
| mkdir -p ./pr | |
| echo ${{ github.event.number }} > ./pr/NR | |
| echo ${{ github.repository }} > ./pr/REPO | |
| cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]') | |
| if [[ "$cling_on" == "ON" ]]; then | |
| export CLING_HASH=$(git ls-remote https://github.com/root-project/cling.git refs/tags/v${{ matrix.cling-version }} | tr '\t' '-') | |
| export LLVM_HASH=$(git ls-remote https://github.com/root-project/llvm-project.git cling-llvm${{ matrix.clang-runtime}} | tr '\t' '-') | |
| else | |
| export CLING_HASH="Repl" | |
| # May need to revert back to both having same llvm_hash, as below cause llvm to be rebuilt everytime commit is made to llvm/llvm-project for release a.x | |
| # which could be quite often for new releases | |
| export LLVM_HASH=$(git ls-remote https://github.com/llvm/llvm-project.git refs/heads/release/${{ matrix.clang-runtime}}.x | tr '\t' '-') | |
| fi | |
| echo "CLING_HASH=$CLING_HASH" >> $GITHUB_ENV | |
| echo "LLVM_HASH=$LLVM_HASH" >> $GITHUB_ENV | |
| - name: Setup default Build Type on *nux | |
| if: runner.os != 'windows' | |
| run: | | |
| echo "BUILD_TYPE=Release" >> $GITHUB_ENV | |
| echo "CODE_COVERAGE=0" >> $GITHUB_ENV | |
| echo "ncpus=$(nproc --all)" >> $GITHUB_ENV | |
| - name: install mamba | |
| uses: mamba-org/setup-micromamba@main | |
| with: | |
| init-shell: >- | |
| ${{ matrix.micromamba_shell_init }} | |
| - name: Setup emsdk | |
| shell: bash -l {0} | |
| run: | | |
| git clone --depth=1 https://github.com/emscripten-core/emsdk.git | |
| cd emsdk | |
| ./emsdk install ${{ matrix.emsdk_ver }} | |
| - name: Restore Cache LLVM/Clang runtime build directory | |
| uses: actions/cache/restore@v4 | |
| id: cache | |
| with: | |
| path: | | |
| llvm-project | |
| ${{ matrix.cling=='On' && 'cling' || '' }} | |
| key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-clang-${{ matrix.clang-runtime }}.x-emscripten | |
| - name: Emscripten build of CppInterOp on Unix systems | |
| if: ${{ runner.os != 'windows' }} | |
| shell: bash -l {0} | |
| run: | | |
| set -e | |
| ./emsdk/emsdk activate ${{matrix.emsdk_ver}} | |
| source ./emsdk/emsdk_env.sh | |
| micromamba create -f environment-wasm.yml --platform=emscripten-wasm32 | |
| export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot | |
| export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm | |
| export CMAKE_PREFIX_PATH=$PREFIX | |
| export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX | |
| LLVM_DIR="$(pwd)/llvm-project" | |
| LLVM_BUILD_DIR="$(pwd)/llvm-project/build" | |
| cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]') | |
| if [[ "${cling_on}" == "ON" ]]; then | |
| CLING_DIR="$(pwd)/cling" | |
| CLING_BUILD_DIR="$(pwd)/cling/build" | |
| CPLUS_INCLUDE_PATH="${CLING_DIR}/tools/cling/include:${CLING_BUILD_DIR}/include:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include" | |
| else | |
| CPLUS_INCLUDE_PATH="${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include" | |
| fi | |
| # Build CppInterOp next to cling and llvm-project. | |
| mkdir build | |
| cd build | |
| if [[ "${cling_on}" == "ON" ]]; then | |
| emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
| -DCPPINTEROP_USE_CLING=ON \ | |
| -DCPPINTEROP_USE_REPL=OFF \ | |
| -DCMAKE_PREFIX_PATH=$PREFIX \ | |
| -DCling_DIR=$LLVM_BUILD_DIR/tools/cling \ | |
| -DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \ | |
| -DLLD_DIR=$LLVM_BUILD_DIR/lib/cmake/lld \ | |
| -DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \ | |
| -DBUILD_SHARED_LIBS=ON \ | |
| -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \ | |
| -DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
| -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ | |
| -DSYSROOT_PATH=$SYSROOT_PATH \ | |
| ../ | |
| else | |
| emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
| -DCMAKE_PREFIX_PATH=$PREFIX \ | |
| -DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \ | |
| -DLLD_DIR=$LLVM_BUILD_DIR/lib/cmake/lld \ | |
| -DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \ | |
| -DBUILD_SHARED_LIBS=ON \ | |
| -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \ | |
| -DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
| -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ | |
| -DSYSROOT_PATH=$SYSROOT_PATH \ | |
| ../ | |
| fi | |
| emmake make -j ${{ env.ncpus }} check-cppinterop | |
| cd ./unittests/CppInterOp/ | |
| # Fresh install browsers, and run Emscripten tests in them | |
| # This is to match the Emscripten build instructions, where | |
| # we run in a fresh browser, to stop any extra installed | |
| # stuff interferring with the running of the tests | |
| # Explaination of options for emrun | |
| # --browser (name of browser on path) | |
| # --kill_exit makes it so that when emrun finishes, | |
| # that the headless browser we create is killed along with it | |
| # --timeout 60 is such that emrun is killed after 60 seconds if | |
| # still running. emrun should have finished long before then, | |
| # so if it is still running, something went wrong (such as a test | |
| # which crashed the html file). This will cause the ci to fail, | |
| # as a non 0 value of will be returned. | |
| # In the case of Chrome we have the extra --no-sandbox flag, as on | |
| # Ubuntu Chrome will refuse to run otherwise, as it expects to have | |
| # been installed with admin privileges. This flag allows it to run | |
| # in userspace. | |
| # Install Firefox | |
| wget "https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US" -O Firefox-latest.dmg | |
| hdiutil attach Firefox-latest.dmg | |
| cp -r /Volumes/Firefox/Firefox.app $PWD | |
| hdiutil detach /Volumes/Firefox | |
| cd ./Firefox.app/Contents/MacOS/ | |
| export PATH="$PWD:$PATH" | |
| cd - | |
| # Install Google Chrome | |
| wget https://dl.google.com/chrome/mac/stable/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg | |
| pkgutil --expand-full googlechrome.pkg google-chrome | |
| cd ./google-chrome/GoogleChrome.pkg/Payload/Google\ Chrome.app/Contents/MacOS/ | |
| export PATH="$PWD:$PATH" | |
| cd - | |
| # Run tests in browsers | |
| echo "Running CppInterOpTests in Firefox" | |
| emrun --browser="firefox" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html | |
| echo "Running DynamicLibraryManagerTests in Firefox" | |
| emrun --browser="firefox" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html | |
| echo "Running CppInterOpTests in Google Chrome" | |
| emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html | |
| echo "Running DynamicLibraryManagerTests in Google Chrome" | |
| emrun --browser="Google Chrome" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html | |
| cd ../../ | |
| emmake make -j ${{ env.ncpus }} install | |
| cd .. | |
| echo "SYSROOT_PATH=$SYSROOT_PATH" >> $GITHUB_ENV | |
| echo "CB_PYTHON_DIR=$CB_PYTHON_DIR" >> $GITHUB_ENV | |
| echo "CPPINTEROP_DIR=$CPPINTEROP_DIR" >> $GITHUB_ENV | |
| echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV | |
| echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV | |
| echo "PREFIX=$PREFIX" >> $GITHUB_ENV | |
| - name: Build xeus-cpp | |
| shell: bash -l {0} | |
| run: | | |
| ./emsdk/emsdk activate ${{matrix.emsdk_ver}} | |
| source ./emsdk/emsdk_env.sh | |
| micromamba activate CppInterOp-wasm | |
| git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git | |
| cd ./xeus-cpp | |
| mkdir build | |
| pushd build | |
| export CMAKE_PREFIX_PATH=${{ env.PREFIX }} | |
| export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }} | |
| emcmake cmake \ | |
| -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
| -DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \ | |
| -DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \ | |
| -DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \ | |
| -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ | |
| -DSYSROOT_PATH=${{ env.SYSROOT_PATH }} \ | |
| .. | |
| emmake make -j ${{ env.ncpus }} install | |
| - name: Test xeus-cpp C++ Emscripten | |
| shell: bash -l {0} | |
| run: | | |
| set -e | |
| micromamba activate CppInterOp-wasm | |
| cd ./xeus-cpp/build/test | |
| node test_xeus_cpp.js | |
| - name: Jupyter Lite integration | |
| shell: bash -l {0} | |
| run: | | |
| cd ./xeus-cpp/ | |
| micromamba create -n xeus-lite-host jupyterlite-core -c conda-forge | |
| micromamba activate xeus-lite-host | |
| python -m pip install jupyterlite-xeus jupyterlite-core jupyterlab notebook libarchive-c | |
| jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./xeus-cpp/dist/ | |
| deploy: | |
| needs: build | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |