forked from open-quantum-safe/liboqs-java
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (90 loc) · 4.26 KB
/
build.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
name: Build and Test
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-test:
name: Build and Test on ${{ matrix.os }} with JDK ${{ matrix.java-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
java-version: [ '11', '17', '21' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true # Fetch submodules
- if: matrix.os == 'windows-latest'
name: Install dependencies to build liboqs
run: |
choco install cmake ninja openssl
- if: matrix.os == 'macos-latest'
name: Install dependencies to build liboqs
run: |
brew install cmake ninja openssl
- if: matrix.os == 'ubuntu-latest'
name: Install dependencies to build liboqs
run: |
sudo apt update -qq
sudo apt install -y cmake build-essential ninja-build libssl-dev
- if: matrix.os == 'windows-latest'
name: Build liboqs
run: |
mkdir build
cd build
cmake .. -G"Ninja" -DBUILD_SHARED_LIBS=ON -DOQS_BUILD_ONLY_LIB=ON
ninja install
working-directory: liboqs
- if: matrix.os != 'windows-latest'
name: Build liboqs
run: |
mkdir build
cd build
cmake .. -G"Ninja" -DBUILD_SHARED_LIBS=ON -DOQS_BUILD_ONLY_LIB=ON
sudo ninja install
working-directory: liboqs
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
cache: 'maven'
- if: matrix.os == 'macos-latest'
name: Resolve all maven project dependencies and build liboqs-java for MacOS
run: |
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/lib"
mvn package -P macosx
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/KEMExample.java
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/SigExample.java
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/RandExample.java
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ KEMExample
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ SigExample
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ RandExample
- if: matrix.os == 'ubuntu-latest'
name: Resolve all maven project dependencies and build liboqs-java for Linux
run: |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
mvn package -P linux
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/KEMExample.java
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/SigExample.java
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/RandExample.java
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ KEMExample
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ SigExample
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ RandExample
- if: matrix.os == 'windows-latest'
name: Resolve all maven project dependencies and build liboqs-java for Windows
run: |
$env:PATH = $env:PATH + ";" + "C:/Program Files (x86)/liboqs/bin/"
mvn package -P windows
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/KEMExample.java
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/SigExample.java
javac -cp target/liboqs-java-jar-with-dependencies.jar examples/RandExample.java
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ KEMExample
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ SigExample
java -Djava.library.path=target/ -cp target/liboqs-java-jar-with-dependencies.jar:examples/ RandExample