Skip to content

Fixing build

Fixing build #1

Workflow file for this run

name: release
on:
push:
tags:
- 'release/v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel]
build_type: [Release]
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install python dependencies
run: |
pip install numpy lit
- name: Install gmp for Mac
if: contains(matrix.os, 'macos')
run: |
wget https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz
tar xf gmp-6.3.0.tar.xz
cd gmp-6.3.0
./configure --enable-static --enable-cxx --enable-shared --with-pic
make -j8
sudo make install
cd ..
- name: Install zlib for Mac static
if: contains(matrix.os, 'macos')
run: |
wget https://zlib.net/fossils/zlib-1.3.1.tar.gz
tar xzvf zlib-1.3.1.tar.gz
cd zlib-1.3.1
./configure --static
make -j8
sudo make install
cd ..
- name: Install mpfr for Mac
if: contains(matrix.os, 'macos')
run: |
wget https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz
tar xf mpfr-4.2.1.tar.xz
cd mpfr-4.2.1
./configure --enable-static --enable-cxx --enable-shared
make -j8
sudo make install
cd ..
- name: Install dependencies for Linux
if: contains(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -yq help2man libgmp-dev libmpfr-dev perl
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: release-${{ matrix.os }}-${{ matrix.build_type }}
max-size: 500M
- name: Checkout & build cereal
run: |
wget https://github.com/USCiLab/cereal/archive/v1.3.2.tar.gz
tar xvf v1.3.2.tar.gz
if sed --version >/dev/null 2>&1; then
sed -i 's|::template apply|::apply|' cereal-1.3.2/include/cereal/types/tuple.hpp
else
sed -i '' 's|::template apply|::apply|' cereal-1.3.2/include/cereal/types/tuple.hpp
fi
cd cereal-1.3.2
mkdir build
cd build
cmake -DJUST_INSTALL_CEREAL=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
make -j6
sudo make install
cd ..
- name: Checkout armadillo static
run: |
wget https://sourceforge.net/projects/arma/files/armadillo-14.0.2.tar.xz
tar xvf armadillo-14.0.2.tar.xz
cd armadillo-14.0.2/
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
make -j6
sudo make install
cd ../..
- name: Checkout & build ensmallen
run: |
wget https://github.com/mlpack/ensmallen/archive/refs/tags/2.22.2.tar.gz
tar xvf 2.22.2.tar.gz
cd ensmallen-2.22.2
mkdir build
cd build
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
cmake --build . --config ${{matrix.build_type}} -v
sudo cmake --install . --config ${{matrix.build_type}} -v
cd ../..
- name: Checkout mlpack
uses: actions/checkout@v4
with:
repository: mlpack/mlpack
ref: 4.6.2
path: mlpack
- name: Build mlpack
run: |
cd mlpack
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON -DBUILD_CLI_EXECUTABLES=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
cmake --build . --config ${{matrix.build_type}} -v
sudo make install
cd ../..
- uses: actions/checkout@v4
with:
path: project
submodules: 'true'
- name: Build project
run: |
cd project
mkdir -p build && cd build
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DBUILD_SHARED_LIBS=OFF \
-DEXTRA_SYNTH=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-S ..
cmake --build . --config ${{matrix.build_type}} -v
- name: Test
run: ctest -C ${{matrix.build_type}} --verbose
- name: run it to check it executes
run: |
echo "Running version command"
./project/build/arjun --version
echo $?
echo "Running help command"
./project/build/arjun --help
echo $?
- name: Determine artifact name
id: artifact
shell: bash
run: |
OS="${{ matrix.os }}"
if [[ "$OS" == "ubuntu-latest" ]]; then
echo "name=arjun-linux-amd64" >> "$GITHUB_OUTPUT"
elif [[ "$OS" == "ubuntu-24.04-arm" ]]; then
echo "name=arjun-linux-arm64" >> "$GITHUB_OUTPUT"
elif [[ "$OS" == "macos-15" ]]; then
echo "name=arjun-mac-arm64" >> "$GITHUB_OUTPUT"
elif [[ "$OS" == "macos-15-intel" ]]; then
echo "name=arjun-mac-x86_64" >> "$GITHUB_OUTPUT"
fi
- name: Package artifact
run: |
mkdir -p dist
cp project/build/arjun dist/
cp project/build/test-synth dist/ 2>/dev/null || true
cp -r project/build/lib dist/ 2>/dev/null || true
cp -r project/build/include dist/ 2>/dev/null || true
tar czf ${{ steps.artifact.outputs.name }}.tar.gz -C dist .
- name: Upload artifact for release job
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact.outputs.name }}
path: ${{ steps.artifact.outputs.name }}.tar.gz
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Set release name
run: |
TAG="${{ github.ref_name }}"
echo "RELEASE_NAME=Arjun ${TAG#release/}" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.RELEASE_NAME }}
files: artifacts/**/*.tar.gz
generate_release_notes: true