Skip to content

Commit 1d4329e

Browse files
authored
Add Debian and Ubuntu OQS ci-containers. (#6)
* Add Debian and Ubuntu OQS containers for testing. Keep circleci-openjdk-9 container as well. Address #4 * Update script to check for dependency changes during the last day * Update CCI config. First clone liboqs and check every step if commit in last day
1 parent 66cd43e commit 1d4329e

File tree

2 files changed

+107
-61
lines changed

2 files changed

+107
-61
lines changed

.circleci/config.yml

Lines changed: 85 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,85 @@
1-
version: 2 # use CircleCI 2.0
2-
jobs:
3-
build:
4-
5-
working_directory: ~/liboqs-java # directory where steps will run
6-
7-
docker: # run the steps with Docker
8-
- image: circleci/openjdk:9-jdk
9-
10-
steps: # a collection of executable commands
11-
12-
- checkout # check out source code to working directory
13-
14-
- run:
15-
name: Install liboqs dependencies
16-
command: sudo apt-get update && sudo apt-get install cmake gcc ninja-build libssl-dev python3-pytest python3-pytest-xdist unzip xsltproc doxygen graphviz -y
17-
18-
- run:
19-
name: Clone liboqs-master
20-
command: .circleci/git_no_checkin_in_last_day.sh || (cd ~/ && git clone --branch master --single-branch https://github.com/open-quantum-safe/liboqs)
21-
22-
- run:
23-
name: Build liboqs-master
24-
command: .circleci/git_no_checkin_in_last_day.sh || (cd ~/liboqs && mkdir build && cd build && cmake -GNinja -DBUILD_SHARED_LIBS=ON .. && ninja && sudo ninja install)
25-
26-
- run:
27-
name: Print Java home contents
28-
command: java -version && echo $JAVA_HOME && ls $JAVA_HOME
29-
30-
- restore_cache: # restore the saved cache after the first run or if `pom.xml` has changed
31-
key: 'liboqs-java-{{ checksum "pom.xml" }}-{{ arch }}'
32-
33-
- run:
34-
name: Resolve all maven project dependencies
35-
command: mvn dependency:go-offline
36-
37-
- save_cache: # saves project dependencies
38-
paths:
39-
- ~/.m2
40-
key: 'liboqs-java-{{ checksum "pom.xml" }}-{{ arch }}'
41-
42-
- run:
43-
name: Build the package and run the tests
44-
command: export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" && mvn package
45-
46-
- run:
47-
name: Compile KEMs, Signatures and Rand examples
48-
command: 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
49-
50-
- run:
51-
name: Run KEMs, Signatures and Rand examples
52-
command: 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
53-
54-
- store_test_results: # uploads the test metadata from the `target/surefire-reports` directory so that it can show up in the CircleCI dashboard.
55-
path: target/surefire-reports
56-
57-
- store_artifacts: # store the uberjar as an artifact
58-
path: target/liboqs-java.jar
1+
version: 2
2+
3+
.my_job: &myjob
4+
working_directory: ~/liboqs-java
5+
docker:
6+
- image: ${IMAGE}
7+
steps:
8+
- checkout
9+
- run:
10+
name: Clone liboqs-master
11+
command: cd ~/ && git clone --branch master --single-branch https://github.com/open-quantum-safe/liboqs
12+
- run:
13+
name: Install liboqs dependencies
14+
command: .circleci/git_no_checkin_in_last_day.sh || (${SUDO} apt-get update && ${SUDO} apt-get install cmake gcc ninja-build libssl-dev python3-pytest python3-pytest-xdist unzip xsltproc doxygen graphviz -y)
15+
- run:
16+
name: Build liboqs-master
17+
command: .circleci/git_no_checkin_in_last_day.sh || (cd ~/liboqs && mkdir build && cd build && cmake -GNinja -DBUILD_SHARED_LIBS=ON .. && ninja && ${SUDO} ninja install)
18+
- restore_cache:
19+
key: 'liboqs-java-{{ checksum "pom.xml" }}-{{ arch }}'
20+
- run:
21+
name: Resolve all maven project dependencies
22+
command: .circleci/git_no_checkin_in_last_day.sh || (mvn dependency:go-offline)
23+
- save_cache:
24+
paths:
25+
- ~/.m2
26+
key: 'liboqs-java-{{ checksum "pom.xml" }}-{{ arch }}'
27+
- run:
28+
name: Build the package and run the tests
29+
command: .circleci/git_no_checkin_in_last_day.sh || (export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" && mvn package)
30+
- run:
31+
name: Compile KEMs, Signatures and Rand examples
32+
command: >
33+
.circleci/git_no_checkin_in_last_day.sh || (
34+
javac -cp target/liboqs-java.jar examples/KEMExample.java &&
35+
javac -cp target/liboqs-java.jar examples/SigExample.java &&
36+
javac -cp target/liboqs-java.jar examples/RandExample.java )
37+
- run:
38+
name: Run KEMs, Signatures and Rand examples
39+
command: >
40+
.circleci/git_no_checkin_in_last_day.sh || (
41+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" &&
42+
java -Djava.library.path=target/ -cp target/liboqs-java.jar:examples/ KEMExample &&
43+
java -Djava.library.path=target/ -cp target/liboqs-java.jar:examples/ SigExample &&
44+
java -Djava.library.path=target/ -cp target/liboqs-java.jar:examples/ RandExample )
45+
- store_test_results:
46+
path: target/surefire-reports
47+
- store_artifacts:
48+
path: target/liboqs-java.jar
49+
50+
jobs:
51+
circleci-openjdk-9:
52+
<<: *myjob
53+
environment:
54+
IMAGE: circleci/openjdk:9-jdk
55+
SUDO: sudo
56+
debian-buster-amd64:
57+
<<: *myjob
58+
environment:
59+
IMAGE: openquantumsafe/ci-debian-buster-amd64:latest
60+
SUDO: ''
61+
ubuntu-bionic-x86_64:
62+
<<: *myjob
63+
environment:
64+
IMAGE: openquantumsafe/ci-ubuntu-bionic-x86_64:latest
65+
SUDO: ''
66+
67+
workflows:
68+
version: 2
69+
build:
70+
jobs:
71+
- circleci-openjdk-9
72+
- debian-buster-amd64
73+
- ubuntu-bionic-x86_64
74+
nightly:
75+
triggers:
76+
- schedule:
77+
cron: "0 1 * * *"
78+
filters:
79+
branches:
80+
only:
81+
- master
82+
jobs:
83+
- circleci-openjdk-9
84+
- debian-buster-amd64
85+
- ubuntu-bionic-x86_64

.circleci/git_no_checkin_in_last_day.sh

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,30 @@
22

33
# Detects whether there has been a Git commit in the last day on this
44
# branch. Returns 1 if there has been a commit, 0 if there has not.
5+
# Always returns 1 if running in circleci local
6+
7+
if [ "x${CIRCLECI}" == "xtrue" ] && [ "x${CIRCLE_BUILD_NUM}" == "x" ]; then
8+
echo "Running in circleci local"
9+
exit 1
10+
fi
511

612
r=`git log --name-only --since="1 day ago" -n 2`
713
if [ "x$r" == "x" ]; then
8-
echo "No commit in the last day. No build/test required. Exiting."
9-
exit 0
14+
echo "No liboqs-java commit in the last day. Checking liboqs now."
15+
if [ -d ~/liboqs ]; then
16+
cd ~/liboqs
17+
r=`git log --name-only --since="1 day ago" -n 2`
18+
if [ "x$r" == "x" ]; then
19+
echo "Also no liboqs commit in the last day. No build/test required. Exiting."
20+
exit 0
21+
else
22+
echo "liboqs commit found. Should test."
23+
exit 1
24+
fi
25+
else
26+
echo "Shouldn't happen (liboqs not checked out?). Testing recommended."
27+
exit 1
28+
fi
1029
else
11-
exit 1
30+
exit 1
1231
fi

0 commit comments

Comments
 (0)