Skip to content

Update to fix several things, version bump, update docs. #44

Update to fix several things, version bump, update docs.

Update to fix several things, version bump, update docs. #44

Workflow file for this run

name: Build and Test on Linux
on:
push:
pull_request:
jobs:
build-linux:
name: py${{ matrix.python-version }}_cc=${{ matrix.ccompiler }}_static=${{ matrix.staticlib }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
ccompiler: ["gcc"]
staticlib: ["False"]
env:
CC: ${{ matrix.ccompiler }}
LIBTDLPACK_VERSION: "1.0.0"
LIBTDLPACK_PREFIX: ${{ github.workspace }}/local
LIBTDLPACK_SRC_DIR: ${{ github.workspace }}/libtdlpack-src
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
gfortran \
wget
- name: Cache libtdlpack
id: cache-libtdlpack
uses: actions/cache@v4
with:
path: ${{ env.LIBTDLPACK_PREFIX }}
key: ${{ runner.os }}-libtdlpack-${{ env.LIBTDLPACK_VERSION }}-${{ matrix.ccompiler }}-py${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-libtdlpack-${{ env.LIBTDLPACK_VERSION }}-${{ matrix.ccompiler }}-
- name: Build and install libtdlpack
if: steps.cache-libtdlpack.outputs.cache-hit != 'true'
run: |
echo "Building libtdlpack ${LIBTDLPACK_VERSION}"
rm -rf "${LIBTDLPACK_SRC_DIR}"
mkdir -p "${LIBTDLPACK_SRC_DIR}"
wget -O "${LIBTDLPACK_SRC_DIR}/libtdlpack.tar.gz" \
"https://github.com/NOAA-MDL/libtdlpack/archive/refs/tags/v${LIBTDLPACK_VERSION}.tar.gz"
tar -xzf "${LIBTDLPACK_SRC_DIR}/libtdlpack.tar.gz" -C "${LIBTDLPACK_SRC_DIR}" --strip-components=1
cmake -S "${LIBTDLPACK_SRC_DIR}" -B "${LIBTDLPACK_SRC_DIR}/build" \
-DCMAKE_INSTALL_PREFIX="${LIBTDLPACK_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_OPENMP=ON \
-DBUILD_SHARED_LIBS=ON
cmake --build "${LIBTDLPACK_SRC_DIR}/build" --parallel
cmake --install "${LIBTDLPACK_SRC_DIR}/build"
- name: Show cached libtdlpack contents
run: |
echo "Using libtdlpack from ${LIBTDLPACK_PREFIX}"
find "${LIBTDLPACK_PREFIX}" -maxdepth 3 -type f | sort
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
if [ -f requirements.txt ]; then
python -m pip install -r requirements.txt
fi
python -m pip install pytest
- name: Install tdlpackio
env:
USE_STATIC_LIBS: ${{ matrix.staticlib }}
CMAKE_PREFIX_PATH: ${{ env.LIBTDLPACK_PREFIX }}
CPATH: ${{ env.LIBTDLPACK_PREFIX }}/include
LIBRARY_PATH: ${{ env.LIBTDLPACK_PREFIX }}/lib:${{ env.LIBTDLPACK_PREFIX }}/lib64
LD_LIBRARY_PATH: ${{ env.LIBTDLPACK_PREFIX }}/lib:${{ env.LIBTDLPACK_PREFIX }}/lib64:${{ env.LD_LIBRARY_PATH }}
PKG_CONFIG_PATH: ${{ env.LIBTDLPACK_PREFIX }}/lib/pkgconfig:${{ env.LIBTDLPACK_PREFIX }}/lib64/pkgconfig
run: |
python --version
python -m pip install .
- name: Show tdlpackio configuration
env:
LD_LIBRARY_PATH: ${{ env.LIBTDLPACK_PREFIX }}/lib:${{ env.LIBTDLPACK_PREFIX }}/lib64:${{ env.LD_LIBRARY_PATH }}
run: |
python -c "import tdlpackio; tdlpackio.show_config()"
- name: Run tests
env:
LD_LIBRARY_PATH: ${{ env.LIBTDLPACK_PREFIX }}/lib:${{ env.LIBTDLPACK_PREFIX }}/lib64:${{ env.LD_LIBRARY_PATH }}
run: |
pytest -v tests/