-
Notifications
You must be signed in to change notification settings - Fork 5
107 lines (91 loc) · 3.8 KB
/
Copy pathbuild_linux.yml
File metadata and controls
107 lines (91 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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/