From 7c0846d60e6d70ae30708123103f56aaf6276a15 Mon Sep 17 00:00:00 2001 From: Breno A Date: Sun, 19 May 2024 05:01:13 -0300 Subject: [PATCH] ci: build and test --- .github/workflows/build.yml | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..990c6f7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,61 @@ +name: Build and Test + +on: + workflow_dispatch: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + openjdk-11: + name: Build and Test on OpenJDK 11 + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies to build liboqs + run: | + sudo apt update -qq + sudo apt install -y cmake build-essential ninja-build libssl-dev + + - name: Clone liboqs + run: git clone --branch main --single-branch --depth 1 https://github.com/open-quantum-safe/liboqs.git + + - 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 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + + - name: Resolve all maven project dependencies + run: mvn dependency:go-offline + + - name: Build liboqs-java and run tests + run: | + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" + mvn package + + - 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