Skip to content

CI: Same build commands for test_pip_pkg and cpython_interop #4

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 32 additions & 17 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:

build_to_wasm:
name: Build LPython to WASM
runs-on: "ubuntu-latest"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -130,6 +130,7 @@ jobs:

- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}

- name : Remove existing node
Expand All @@ -149,11 +150,8 @@ jobs:
cd emsdk

./emsdk install 3.1.35

./emsdk activate 3.1.35

./emsdk install node-14.18.2-64bit

./emsdk activate node-14.18.2-64bit

- name: Show Emscripten and Node Info
Expand All @@ -173,7 +171,20 @@ jobs:
set -ex
source $HOME/ext/emsdk/emsdk_env.sh # Activate Emscripten
./build0.sh
./build_to_wasm.sh
emcmake cmake . -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS_DEBUG="-Wall -Wextra -fexceptions" \
-DWITH_LLVM=no \
-DLPYTHON_BUILD_TO_WASM=yes \
-DLFORTRAN_BUILD_ALL=yes \
-DWITH_STACKTRACE=no \
-DWITH_RUNTIME_STACKTRACE=no \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache

cmake --build . -j16 --target install

- name: Test built lpython.wasm
shell: bash -l {0}
Expand All @@ -182,7 +193,7 @@ jobs:
source $HOME/ext/emsdk/emsdk_env.sh # Activate Emscripten
which node
node -v
node src/lpython/tests/test_lpython.js
node --experimental-wasm-bigint src/lpython/tests/test_lpython.js

test_pip_pkgs:
name: Test PIP Installable Packages
Expand All @@ -196,26 +207,30 @@ jobs:
with:
environment-file: ci/environment.yml
create-args: >-
python=3.10
bison=3.4

- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}

- name: Setup Platform (Linux)
shell: bash -l {0}
run: |
echo "LFORTRAN_CMAKE_GENERATOR=Unix Makefiles" >> $GITHUB_ENV
echo "WIN=0" >> $GITHUB_ENV
echo "MACOS=0" >> $GITHUB_ENV
echo "ENABLE_RUNTIME_STACKTRACE=yes" >> $GITHUB_ENV
echo "CMAKE_C_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV

- name: Build Linux
shell: bash -l {0}
run: |
xonsh ci/build.xsh
./build0.sh
cmake . -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_LLVM=yes \
-DLFORTRAN_BUILD_ALL=yes \
-DWITH_STACKTRACE=no \
-DWITH_RUNTIME_STACKTRACE=yes \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache

cmake --build . -j16 --target install

- name: PIP show version
shell: bash -l {0}
Expand Down
8 changes: 8 additions & 0 deletions src/lpython/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ endif()
# Add one main test suite for LPython, composed of many individual cpp files:
add_executable(test_lpython ${SRC})
target_link_libraries(test_lpython lpython_lib p::doctest)
if (HAVE_BUILD_TO_WASM)
set(WASM_COMPILE_FLAGS "-g0 -fexceptions")
set(WASM_LINK_FLAGS
"-Oz -g0 -fexceptions -Wall -Wextra -s ASSERTIONS -s ALLOW_MEMORY_GROWTH=1 -s WASM_BIGINT"
)
set_target_properties(test_lpython PROPERTIES COMPILE_FLAGS ${WASM_COMPILE_FLAGS})
set_target_properties(test_lpython PROPERTIES LINK_FLAGS ${WASM_LINK_FLAGS})
endif()
add_test(test_lpython ${PROJECT_BINARY_DIR}/test_lpython)

set_target_properties(test_lpython PROPERTIES
Expand Down