Skip to content

Commit f53a0c6

Browse files
committed
[admin] workflow to build milk
1 parent 27e527e commit f53a0c6

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Setup milk
2+
description: Build and cache the milk-org/milk library with Python module support
3+
4+
inputs:
5+
milk-version:
6+
description: Git commit, tag, or branch of milk-org/milk to build
7+
required: false
8+
default: '3c12d7f9e7a88d6a8184161f337d1f71e24b931f'
9+
install-prefix:
10+
description: Installation prefix for milk
11+
required: false
12+
default: '/usr/local/milk'
13+
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Install system dependencies
18+
shell: bash
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y cmake pkg-config libcfitsio-dev pybind11-dev
22+
23+
- name: Cache milk install
24+
id: cache-milk
25+
uses: actions/cache@v4
26+
with:
27+
path: ${{ inputs.install-prefix }}
28+
key: milk-${{ inputs.milk-version }}-${{ runner.os }}
29+
30+
- name: Build and install milk
31+
if: steps.cache-milk.outputs.cache-hit != 'true'
32+
shell: bash
33+
run: |
34+
git clone --recursive https://github.com/milk-org/milk.git /tmp/milk-build
35+
cd /tmp/milk-build
36+
git checkout ${{ inputs.milk-version }}
37+
git submodule update --init --recursive
38+
mkdir _build && cd _build
39+
cmake .. \
40+
-DCMAKE_INSTALL_PREFIX=${{ inputs.install-prefix }} \
41+
-Dbuild_python_module=ON
42+
make -j$(nproc)
43+
sudo make install
44+
rm -rf /tmp/milk-build
45+
46+
- name: Configure library paths
47+
shell: bash
48+
run: |
49+
sudo ldconfig
50+
echo "MILK_INSTALLDIR=${{ inputs.install-prefix }}" >> "$GITHUB_ENV"
51+
echo "LD_LIBRARY_PATH=${{ inputs.install-prefix }}/lib:${LD_LIBRARY_PATH}" >> "$GITHUB_ENV"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919

20+
- name: Build and cache milk
21+
uses: ./.github/actions/setup-milk
22+
2023
- name: Set up Python
2124
id: setup-python
2225
uses: actions/setup-python@v5

0 commit comments

Comments
 (0)