Skip to content

Set version 0.3.3 && update third-party packages versions && downgrade msys2 && compatibility with now openfhe-development #287

Set version 0.3.3 && update third-party packages versions && downgrade msys2 && compatibility with now openfhe-development

Set version 0.3.3 && update third-party packages versions && downgrade msys2 && compatibility with now openfhe-development #287

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths-ignore:
- 'CITATION.bib'
- 'LICENSE.md'
- 'README.md'
- '.zenodo.json'
pull_request:
paths-ignore:
- 'CITATION.bib'
- 'LICENSE.md'
- 'README.md'
- '.zenodo.json'
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
env:
# Modify these variables for upstream package versions - do NOT hardcode the version
# anywhere else!
OPENFHE_VERSION: '1.2.0'
LIBCXXWRAP_JULIA_VERSION: '0.13.0'
FORCE_CXXWRAP_JL_VERSION: '0.16' # Use only briefly during transition (default: '')
jobs:
test:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os }} - Julia v${{ matrix.julia_version }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
shell: bash
julia_version: '1.9'
- os: macos-latest
shell: bash
julia_version: '1.9'
- os: windows-latest
shell: 'msys2 {0}'
julia_version: '1.9'
- os: ubuntu-latest
shell: bash
julia_version: '1.10'
- os: macos-latest
shell: bash
julia_version: '1.10'
- os: windows-latest
shell: 'msys2 {0}'
julia_version: '1.10'
# Set default shell as suggested here: https://github.community/t/setting-default-shell-or-other-step-metadata-conditionally-in-workflows/154055
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
# TODO: set msys2/setup-msys2@v2 once openfhe-development 1.2.1 is available and fixes issue with GCC v14.1
- uses: msys2/[email protected]
if: ${{ matrix.os == 'windows-latest' }}
with:
# TODO: set true once openfhe-development 1.2.1 is available and fixes issue with GCC v14.1
update: false
install: git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- name: Install OpenMP
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install libomp
# The following paths are required since with Apple Silicon, Homebrew libraries
# are not in the default search path anymore
echo "DYLD_FALLBACK_LIBRARY_PATH=$(brew --prefix libomp)/lib" >> "${GITHUB_ENV}"
echo "LDFLAGS='-L/opt/homebrew/opt/libomp/lib'" >> "${GITHUB_ENV}"
echo "CPPFLAGS='-I/opt/homebrew/opt/libomp/include'" >> "${GITHUB_ENV}"
- uses: julia-actions/setup-julia@v2
id: setup-julia
with:
version: ${{ matrix.julia_version }}
show-versioninfo: true
- uses: actions/cache@v4
id: cache-openfhe
with:
path: openfhe-development/
key: ${{ matrix.os }}-openfhe-v${{ env.OPENFHE_VERSION }}
- name: Install OpenFHE
if: steps.cache-openfhe.outputs.cache-hit != 'true'
run: |
rm -rf openfhe-development
mkdir -p openfhe-development
cd openfhe-development
git clone https://github.com/openfheorg/openfhe-development.git .
git checkout v$OPENFHE_VERSION
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=../install \
-DWITH_BE2=ON \
-DWITH_BE4=ON \
-DBUILD_BENCHMARKS=OFF \
-DBUILD_UNITTESTS=OFF
make -j 2
make install
- uses: actions/cache@v4
id: cache-libcxxwrap-julia
with:
path: libcxxwrap-julia/
key: ${{ matrix.os }}-libcxxwrap-julia-v${{ env.LIBCXXWRAP_JULIA_VERSION }}-julia-v${{ matrix.julia_version }}
- name: Install libcxxwrap-julia
if: steps.cache-libcxxwrap-julia.outputs.cache-hit != 'true'
run: |
# The following line does somehow not work properly on GitHub Actions under Windows
rm -rf libcxxwrap-julia
mkdir -p libcxxwrap-julia
cd libcxxwrap-julia
git clone https://github.com/JuliaInterop/libcxxwrap-julia.git .
git checkout v$LIBCXXWRAP_JULIA_VERSION
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=../install \
-DJulia_PREFIX="$(dirname $JULIA_BINDIR)" \
-G "Unix Makefiles" \
-DJLCXX_BUILD_EXAMPLES=OFF \
-DJLCXX_BUILD_TESTS=OFF
make -j 2
make install
env:
JULIA_BINDIR: ${{ steps.setup-julia.outputs.julia-bindir }}
- name: Build openfhe-julia
run: |
mkdir build && cd build
JlCxx_DIR="$GITHUB_WORKSPACE/libcxxwrap-julia/install/"
OpenFHE_DIR="$GITHUB_WORKSPACE/openfhe-development/install/"
cmake .. \
-DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_PREFIX_PATH="$JlCxx_DIR;$OpenFHE_DIR" \
-DJulia_PREFIX="$(dirname $JULIA_BINDIR)" \
-G "Unix Makefiles"
make -j 2
make install
libopenfhe_julia_path="$(dirname $(pwd))/install/lib/libopenfhe_julia.so"
echo "LIBOPENFHE_JULIA_PATH=$libopenfhe_julia_path" >> "$GITHUB_ENV"
env:
JULIA_BINDIR: ${{ steps.setup-julia.outputs.julia-bindir }}
- name: Initialize basic Julia tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cd test
julia --color=yes init.jl $LIBOPENFHE_JULIA_PATH
- name: Run basic Julia tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
julia --color=yes --project=test test/test.jl
# The following env setting is required until
# https://openfhe.discourse.group/t/bug-in-rpath-runpath-specification-in-cmakelists-txt/1071
# is fixed
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/openfhe-development/install/lib
- name: Retrieve downstream package
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/checkout@v4
with:
repository: hpsc-lab/OpenFHE.jl
path: test/OpenFHE.jl
- name: Initialize downstream Julia tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cp test/LocalPreferences.toml test/OpenFHE.jl/LocalPreferences.toml
sed -i "s/MyOpenFHE/OpenFHE/" test/OpenFHE.jl/LocalPreferences.toml
if [ -n "$FORCE_CXXWRAP_JL_VERSION" ]; then
sed -i "s/CxxWrap = \"0[^\"]*\"/CxxWrap = \"=$FORCE_CXXWRAP_JL_VERSION\"/" test/OpenFHE.jl/Project.toml
# TODO: the following two lines are a workaround for using an incompatible JLL package
sed -i "s/using openfhe_julia_jll: libopenfhe_julia/#using openfhe_julia_jll: libopenfhe_julia/" test/OpenFHE.jl/src/OpenFHE.jl
sed -i "s/const libopenfhe_julia_path = @load_preference(\"libopenfhe_julia\", libopenfhe_julia)/const libopenfhe_julia_path = @load_preference(\"libopenfhe_julia\")#, libopenfhe_julia)/" test/OpenFHE.jl/src/OpenFHE.jl
fi
- name: Run downstream Julia tests
if: ${{ matrix.os == 'ubuntu-latest' }}
shell: julia --color=yes --project=test/OpenFHE.jl {0}
run: |
using Pkg
Pkg.instantiate()
using OpenFHE
@show OpenFHE.libopenfhe_julia_path
Pkg.test(coverage=false)
# The following env setting is required until
# https://openfhe.discourse.group/t/bug-in-rpath-runpath-specification-in-cmakelists-txt/1071
# is fixed
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/openfhe-development/install/lib
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session for debugging
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && always() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15