Skip to content

Add necessary functions for custom permutations #242

Add necessary functions for custom permutations

Add necessary functions for custom permutations #242

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.1.4'
LIBCXXWRAP_JULIA_VERSION: '0.12.2'
JULIA_VERSION: '1.9'
FORCE_CXXWRAP_JL_VERSION: '0.15' # Use only briefly during transition (default: '')
jobs:
test:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
shell: bash
- os: macos-12
shell: bash
- os: windows-latest
shell: 'msys2 {0}'
# 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
- uses: msys2/setup-msys2@v2
if: ${{ matrix.os == 'windows-latest' }}
with:
update: true
install: git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- uses: julia-actions/setup-julia@v1
id: setup-julia
with:
version: ${{ env.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${{ env.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: sloede/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