Infiltration models #200
Workflow file for this run
This file contains 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: CMake integration | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
# Newer commits should cancel old runs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
cmake-integration: | |
name: Test CMake integration as a subproject | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
path: neml2 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: "3.28" | |
- name: Install PyTorch | |
run: pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu | |
- name: Create a source file for testing purposes | |
run: | | |
echo -e "\ | |
#include \"neml2/base/Registry.h\"\n\ | |
int main() {\n\ | |
return 0;\n\ | |
}\ | |
" > main.cxx | |
- name: Create a CMakeLists.txt file for testing purposes | |
run: | | |
echo -e "\ | |
cmake_minimum_required(VERSION 3.28) | |
project(FOO)\n\ | |
add_subdirectory(neml2)\n\ | |
add_executable(foo main.cxx)\n\ | |
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)\n\ | |
target_link_libraries(foo neml2)\n\ | |
" > CMakeLists.txt | |
- name: Configure with CMake | |
run: cmake -DNEML2_TESTS=OFF -B build . | |
- name: Compile | |
run: cmake --build build --target all -j 2 -- | |
- run: ./build/foo |