Skip to content

Commit

Permalink
Merge pull request #524 from vsbogd/add-minimal-ci
Browse files Browse the repository at this point in the history
Add minimal CI workflow
  • Loading branch information
vsbogd authored Dec 20, 2023
2 parents ddbba5b + 225f40e commit ed3901b
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
101 changes: 101 additions & 0 deletions .github/workflows/minimal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This workflow is intended to run tests on minimal MeTTa interpreter.
# It is indicative and temporary, it doesn't prevent any changes from merging.

# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.

name: minimal

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
run:
runs-on: ubuntu-20.04

steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Install Rust stable
uses: actions-rs/[email protected]
with:
toolchain: stable
override: true

- name: Build Rust library
working-directory: ./lib
run: |
cargo check --features minimal
cargo build --features minimal
- name: Test Rust library
working-directory: ./lib
run: |
RUST_LOG=hyperon=debug cargo test --features minimal
- name: Install cbindgen
uses: actions-rs/[email protected]
with:
command: install
args: cbindgen

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install CMake
uses: jwlawson/[email protected]
with:
cmake-version: 3.16.x

- name: Install Conan
uses: turtlebrowser/[email protected]
with:
version: 1.60.2

- name: Setup Conan profile
run: |
conan profile new --detect default
- name: Print environment
run: |
echo "rustc --version"
rustc --version
echo "cbindgen --version"
cbindgen --version
echo "python --version"
python --version
echo "conan --version"
conan --version
echo "conan profile show default"
conan profile show default
echo "gcc --version"
gcc --version
echo "cmake --version"
cmake --version
echo "make --version"
make --version
- name: Setup C API build
run: |
mkdir -p build
cd build
# specify C compiler as conan could not find it automatically
# see https://github.com/conan-io/conan/issues/4322
cmake -DCARGO_ARGS="--features hyperon/minimal" -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE=`which python` -DCMAKE_C_COMPILER=gcc ..
- name: Build C API
working-directory: ./build
run: make

- name: Test C API
working-directory: ./build
run: make check
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ExternalProject_Add(
CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=${HYPERONC_INSTALL_PREFIX}"
"-DCMAKE_BUILD_TYPE=${BUILD_CONFIGURATION}"
"-DCARGO_ARGS=${CARGO_ARGS}"
)

ExternalProject_Get_Property(hyperonc BINARY_DIR)
Expand Down
5 changes: 4 additions & 1 deletion c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ add_custom_target(show-build-type-vars COMMAND ${CMAKE_COMMAND} -E echo
set(HYPERONC_STATIC_LIB_FILE ${CMAKE_STATIC_LIBRARY_PREFIX}hyperonc${CMAKE_STATIC_LIBRARY_SUFFIX})
set(HYPERONC_STATIC_LIB_PATH ${HYPERONC_TARGET_DIR}/${HYPERONC_STATIC_LIB_FILE})
set(HYPERONC_INCLUDE_DIR ${HYPERONC_TARGET_DIR}/hyperon)
separate_arguments(CARGO_ARGS_LIST NATIVE_COMMAND ${CARGO_ARGS})

add_custom_target(build-hyperonc ALL
COMMAND cargo build
${CARGO_ARGS_LIST}
$<${IS_RELEASE_BUILD}:--release>
--target-dir ${HYPERONC_TARGET_DIR}

Expand Down Expand Up @@ -115,5 +117,6 @@ install(DIRECTORY "${HYPERONC_INCLUDE_DIR}"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/hyperonc-config.cmake"
DESTINATION "${CONFIG_INSTALL_PATH}")

add_test(NAME rust_c_api COMMAND cargo test --target-dir ${HYPERONC_TARGET_DIR}
add_test(NAME rust_c_api
COMMAND cargo test ${CARGO_ARGS_LIST} --target-dir ${HYPERONC_TARGET_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

0 comments on commit ed3901b

Please sign in to comment.