From 9cd4c23d8b9d77517d54944dfefb456bf62c1297 Mon Sep 17 00:00:00 2001 From: Kartik Singh Date: Mon, 24 Jun 2024 13:47:08 -0700 Subject: [PATCH] Run Python example in CI --- .github/workflows/linux.yml | 7 +++++-- .github/workflows/mac.yml | 1 + .github/workflows/windows.yml | 11 +++++++---- examples/libcalc/script.lisp | 12 +++++++++--- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 951ef257..a4288d37 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -34,12 +34,15 @@ jobs: working-directory: examples/libcalc env: SBCL_SRC: ${{ github.workspace }}/../sbcl - LIBRARY_PATH: ${{ github.workspace }}/../sbcl/src/runtime:. - LD_LIBRARY_PATH: ${{ github.workspace }}/../sbcl/src/runtime:. + LIBRARY_PATH: ${{ github.workspace }}/../sbcl/src/runtime:${{ github.workspace }}/examples/libcalc + LD_LIBRARY_PATH: ${{ github.workspace }}/../sbcl/src/runtime:/usr/local/lib CL_SOURCE_REGISTRY: "${{ github.workspace }}//" run: | $SBCL_SRC/run-sbcl.sh --script script.lisp gcc -Wall -fPIC -shared -o libcalc.so libcalc.c -lsbcl gcc -Wall -o example example.c -lcalc -lsbcl + sudo mv libcalc.so /usr/local/lib + sudo cp libcalc.core /usr/local/lib echo "(+ 1 2)" | ./example + echo "(+ 1 2)" | python ./example.py \ No newline at end of file diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index d277d351..b90b84ad 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -45,4 +45,5 @@ jobs: gcc -Wall -fPIC -shared -o libcalc.dylib libcalc.c -lsbcl gcc -Wall -o example example.c -lcalc -lsbcl echo "(+ 1 2)" | ./example + echo "(+ 1 2)" | python3 ./example.py \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 78dd33ad..b1ff3b20 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -44,10 +44,13 @@ jobs: working-directory: examples/libcalc env: SBCL_SRC: ${{ github.workspace }}/../sbcl - LIBRARY_PATH: ${{ github.workspace }}/../sbcl/src/runtime;. CL_SOURCE_REGISTRY: "${{ github.workspace }}//" + MSYS2_PATH_TYPE: inherit run: | $SBCL_SRC/run-sbcl.sh --script script.lisp - gcc -Wall -fPIC -shared -o libcalc.dll libcalc.c -Wl,--export-all-symbols -Wl,--whole-archive -lsbcl -Wl,--no-whole-archive -ladvapi32 -lsynchronization -lws2_32 -lzstd - gcc -Wall -o example example.c -lcalc - echo "(+ 1 2)" | ./example.exe \ No newline at end of file + gcc -Wall -fPIC -shared -Wl,--export-all-symbols -o libcalc.dll libcalc.c -Wl,--whole-archive $SBCL_SRC/src/runtime/libsbcl.a -Wl,--no-whole-archive -ladvapi32 -lsynchronization -lws2_32 -lzstd + gcc -Wall -o example example.c -lcalc -L. + mv libcalc.dll $MSYSTEM_PREFIX/bin + cp libcalc.core $MSYSTEM_PREFIX/bin + echo "(+ 1 2)" | ./example.exe + echo "(+ 1 2)" | python ./example.py diff --git a/examples/libcalc/script.lisp b/examples/libcalc/script.lisp index 4a954663..c803ff6d 100644 --- a/examples/libcalc/script.lisp +++ b/examples/libcalc/script.lisp @@ -2,9 +2,15 @@ (asdf:load-system '#:libcalc) +(when (uiop:getenv "CI") + (push :github-ci *features*)) (in-package #:sbcl-librarian/example/libcalc) -(build-bindings libcalc ".") -(build-python-bindings libcalc ".") -(build-core-and-die libcalc "." :compression nil) +(let ((sbcl-librarian::*non-static-lossage-handler* t)) + (build-bindings libcalc ".") + (build-python-bindings libcalc "." :library-path + #+(and github-ci win32) (concatenate 'string (uiop:getenv "MSYSTEM_PREFIX") "/bin/libcalc.dll") + #+(and github-ci linux) "/usr/local/lib/libcalc.so" + #+(and github-ci darwin) nil) + (build-core-and-die libcalc "." :compression nil))