Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI #11

Merged
merged 17 commits into from
Jan 19, 2024
97 changes: 44 additions & 53 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,95 +13,87 @@ defaults:

jobs:
unix:

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-11, macos-12]
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
- name: install mamba
uses: mamba-org/provision-with-micromamba@main

- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
environment-name: xeus-nelson

- name: cmake configure
- name: Make build directory
run: mkdir build

- name: Configure cmake
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX
working-directory: build

- name: install
run: |
cd build
make -j ${{ steps.cpu-cores.outputs.count }} install
- name: Install
run: make -j ${{ steps.cpu-cores.outputs.count }} install
working-directory: build

- name: test
run: |
cd test
pytest . --reruns 5
- name: Test
run: pytest . --reruns 5
working-directory: test

win:

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: install mamba
uses: mamba-org/provision-with-micromamba@main
- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
with:
init-shell: cmd.exe
environment-file: environment-dev.yml
environment-name: xeus-nelson

- name: micromamba shell hook
shell: powershell
run: |
micromamba shell hook -s cmd.exe -p C:\Users\runneradmin\micromamba-root
- name: Make build directory
run: mkdir build

- name: cmake configure
shell: cmd
- name: Configure cmake
shell: cmd /C call {0}
run: |
call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-nelson
mkdir -p build
cd build
cmake .. ^
-GNinja ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX="%CONDA_PREFIX%\Library"
-DCMAKE_INSTALL_PREFIX="%CONDA_PREFIX%\Library"
working-directory: build

- name: build
shell: cmd
- name: Build
shell: cmd /C call {0}
run: |
call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-nelson
cd build
set CL=/MP
ninja install
working-directory: build

- name: test
shell: cmd
run: |
call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-nelson
cd test
pytest . --reruns 5
- name: Test
shell: cmd /C call {0}
run: pytest . --reruns 5
working-directory: test

emscripten_wasm:

Expand All @@ -110,21 +102,21 @@ jobs:
strategy:
fail-fast: false
matrix:
emsdk_ver: ["2.0.32", "3.1.2"]
emsdk_ver: ["3.1.45", "latest"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install mamba
uses: mamba-org/provision-with-micromamba@main
- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-wasm-build.yml
environment-name: xeus-nelson-wasm-build

- name: Setup emsdk
run: |
micromamba activate xeus-nelson-wasm-build
emsdk install ${{matrix.emsdk_ver}}
emsdk install ${{matrix.emsdk_ver}}

- name: Build xeus-nelson
run: |
Expand All @@ -133,8 +125,8 @@ jobs:
emsdk activate ${{matrix.emsdk_ver}}
source $CONDA_EMSDK_DIR/emsdk_env.sh

micromamba create -f environment-wasm-host.yml --platform=emscripten-32
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32

mkdir build
pushd build

Expand All @@ -150,4 +142,3 @@ jobs:
..

make -j5

8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,11 @@ if (XEUS_NELSON_BUILD_STATIC)
else ()
xnelson_create_target(xeus-nelson-static STATIC xeus-nelson)
endif ()
if (XEUS_NELSON_EMSCRIPTEN_WASM_BUILD)
target_compile_options(xeus-nelson-static PRIVATE -fPIC)
endif ()
list(APPEND XEUS_NELSON_TARGETS xeus-nelson-static)

endif ()

# xnelson
Expand All @@ -271,8 +274,9 @@ if (XEUS_NELSON_EMSCRIPTEN_WASM_BUILD)
include(WasmBuildOptions)
find_package(xeus-lite REQUIRED)
add_executable(xnelson_wasm src/main_emscripten_kernel.cpp)
target_link_libraries(xnelson_wasm PRIVATE xeus-nelson-static xeus-lite)
target_link_libraries(xnelson_wasm PRIVATE xeus-lite)
target_compile_features(xnelson_wasm PRIVATE cxx_std_17)
target_compile_options(xnelson_wasm PRIVATE -fPIC)
xnelson_set_kernel_options(xnelson_wasm)
xeus_wasm_compile_options(xnelson_wasm)
xeus_wasm_link_options(xnelson_wasm "web,worker")
Expand Down