From 73269fd656c9745a3f6c22e0bbba618944379890 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Tue, 10 Oct 2023 15:51:27 -0600 Subject: [PATCH] Update Unix CI (#17) * Changes to make compatible with fpm * Adding fpm support * Adding clarification that you don't need to pre-install BMI binding if using fpm * Updating example dir in GitHub workflow * Tidy * Review instructions and touch up text * Remove obsolete scripts directory * Remove unused code * Rename file with more helpful name * Replace miniconda with micromamba * Update packages for memtest step --------- Co-authored-by: Sam Harrison --- .../{conda-and-cmake.yml => test.yml} | 32 +++++++----------- README.md | 14 +++----- example/CMakeLists.txt | 7 ---- scripts/update_rpaths.sh | 33 ------------------- 4 files changed, 17 insertions(+), 69 deletions(-) rename .github/workflows/{conda-and-cmake.yml => test.yml} (67%) delete mode 100644 scripts/update_rpaths.sh diff --git a/.github/workflows/conda-and-cmake.yml b/.github/workflows/test.yml similarity index 67% rename from .github/workflows/conda-and-cmake.yml rename to .github/workflows/test.yml index 8274798..ef9edba 100644 --- a/.github/workflows/conda-and-cmake.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: Build/Test on: [push, pull_request] jobs: - build-linux-and-macos: + build-test-unix: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository @@ -17,33 +17,24 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - python-version: ["3.8"] build-type: [Release] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v2 + - uses: mamba-org/setup-micromamba@v1 with: - auto-update-conda: true - python-version: ${{ matrix.python-version }} - channels: conda-forge - channel-priority: true + micromamba-version: latest + environment-name: testing + create-args: >- + cmake + fortran-compiler + bmi-fortran - - name: Show conda installation info - run: | - conda info - conda list - - - name: Install build tools and dependencies into env - run: | - conda install -c conda-forge --override-channels fortran-compiler cmake bmi-fortran - conda list - - - name: Make cmake build directory + - name: Make CMake build directory run: cmake -E make_directory build - - name: Configure cmake + - name: Configure CMake working-directory: ${{ github.workspace }}/build run: | cmake $GITHUB_WORKSPACE \ @@ -62,6 +53,7 @@ jobs: if: matrix.os == 'ubuntu-latest' working-directory: ${{ github.workspace }}/example run: | + sudo apt-get update sudo apt-get install -y valgrind valgrind \ --tool=memcheck \ diff --git a/README.md b/README.md index 1909266..efd01e6 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This repository is organized with the following directories: model through its BMI
test
Unit tests for the BMI-ed model
-
examples
+
example
Examples of controlling the model through its BMI
scripts
Helper scripts
@@ -51,7 +51,7 @@ This example can be built on Linux, macOS, and Windows. ### CMake - Linux and macOS -To build this example from source with cmake, +To build this example from source with CMake, using the current Fortran BMI version, run export BMIF_VERSION=2.0 @@ -63,11 +63,7 @@ where `` is the base directory in which the Fortran BMI bindings have been installed (`/usr/local` is the default). When installing into a conda environment, -use the `CONDA_PREFIX` environment variable. - -On macOS only, update runtime paths for all executables with - - source ../scripts/update_rpaths +use the `$CONDA_PREFIX` environment variable. Then, to install (on both Linux and macOS): @@ -179,11 +175,11 @@ heat directory: Run the heat model through its BMI with the `run_bmiheatf` program, which takes a model configuration file -(see the [examples](./examples) directory for a sample) +(see the [example](./example) directory for a sample) as a required parameter. If `run_bmiheatf` is in your path, run it with - run_bmiheatf test.cfg + run_bmiheatf test1.cfg Output from the model is written to the file **bmiheatf.out** in the current directory. diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 2d76316..c9fabb6 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -15,10 +15,3 @@ make_example(get_value_ex) make_example(set_value_ex) make_example(conflicting_instances_ex) make_example(change_diffusivity_ex) - -# file( -# COPY ${CMAKE_CURRENT_SOURCE_DIR}/test1.cfg -# DESTINATION ${CMAKE_BINARY_DIR}/example) -# file( -# COPY ${CMAKE_CURRENT_SOURCE_DIR}/test2.cfg -# DESTINATION ${CMAKE_BINARY_DIR}/example) diff --git a/scripts/update_rpaths.sh b/scripts/update_rpaths.sh deleted file mode 100644 index 10e5b38..0000000 --- a/scripts/update_rpaths.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -# Updates runtime paths for executables on macOS. - -bmif_version=${BMIF_VERSION:-2.0} - -run_install_name_tool() { - install_name_tool \ - -change @rpath/libbmif.$bmif_version.dylib \ - ${CONDA_PREFIX}/lib/libbmif.$bmif_version.dylib \ - -change @rpath/libgfortran.3.dylib \ - ${CONDA_PREFIX}/lib/libgfortran.3.dylib \ - -change @rpath/libquadmath.0.dylib \ - ${CONDA_PREFIX}/lib/libquadmath.0.dylib \ - $1 - echo "- updated $1" -} - -if [[ -z "$CONDA_PREFIX" ]]; then - CONDA_PREFIX=`python -c "import sys; print(sys.prefix)"` -fi - -tests=`ls -1 ./tests/ | egrep "test_"` -for exe in $tests; do - run_install_name_tool ./tests/$exe -done - -examples=`ls -1 ./examples/ | egrep "_ex"` -for exe in $examples; do - run_install_name_tool ./examples/$exe -done - -run_install_name_tool ./heat/run_heatf -run_install_name_tool ./bmi_heat/run_bmiheatf