Skip to content

Update build.yml

Update build.yml #28

Workflow file for this run

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
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- 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:$(pwd)/liboqs/build/bin"
mvn package -P macosx
- 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:$(pwd)/liboqs/build/bin"
mvn package -P linux
- if: matrix.os == 'windows-latest'
name: Resolve all maven project dependencies and build liboqs-java for Windows
run: |
set PATH=%PATH%;%CD%\liboqs\build\bin
mvn package -P windows
- name: Compile KEM, Signatures and Rand examples
run: |
javac -cp target/liboqs-java.jar examples/KEMExample.java
javac -cp target/liboqs-java.jar examples/SigExample.java
javac -cp target/liboqs-java.jar examples/RandExample.java
- name: Run KEM, Signatures and Rand examples
run: |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
java -Djava.library.path=target/ -cp target/liboqs-java.jar:examples/ KEMExample
java -Djava.library.path=target/ -cp target/liboqs-java.jar:examples/ SigExample
java -Djava.library.path=target/ -cp target/liboqs-java.jar:examples/ RandExample