-
Notifications
You must be signed in to change notification settings - Fork 1
181 lines (176 loc) · 6.91 KB
/
ci.yml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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