Skip to content

Commit 776b9df

Browse files
committed
Merge branch 'main' of github.com:ralienpp/cmp-test-suite
2 parents 500919e + 2654a35 commit 776b9df

File tree

4 files changed

+233
-0
lines changed

4 files changed

+233
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
venv*
2+
__pycache__
3+
.git
4+
liboqs-python

.github/workflows/main.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
name: Development Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- pq_migration
8+
pull_request:
9+
branches:
10+
- main
11+
- pq_migration
12+
13+
jobs:
14+
install_dependencies:
15+
name: Install Dependencies
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Check out repo
19+
uses: actions/checkout@v3
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: "3.11.2"
25+
26+
- name: Cache APT packages
27+
id: cache-apt
28+
uses: actions/cache@v3
29+
with:
30+
path: /var/cache/apt
31+
key: ${{ runner.os }}-apt-${{ hashFiles('scripts/setup_pq.sh') }}
32+
restore-keys: |
33+
${{ runner.os }}-apt-
34+
35+
- name: Update APT and install dependencies
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y libssl-dev cmake
39+
40+
- name: Ensure venv directory exists
41+
run: mkdir -p .venv
42+
43+
- name: Cache venv
44+
id: cache-venv
45+
uses: actions/cache@v3
46+
with:
47+
path: .venv
48+
key: ${{ runner.os }}-venv-${{ hashFiles('requirements.txt') }}
49+
restore-keys: |
50+
${{ runner.os }}-venv-
51+
52+
- name: Install dependencies
53+
run: |
54+
python -m venv .venv
55+
source .venv/bin/activate
56+
pip install --upgrade pip
57+
pip install -r requirements.txt
58+
59+
- name: Ensure build directory exists
60+
run: mkdir -p build
61+
62+
- name: Cache build artifacts
63+
id: cache-build
64+
uses: actions/cache@v3
65+
with:
66+
path: build/
67+
key: ${{ runner.os }}-build-${{ hashFiles('./scripts/setup_pq.sh') }}
68+
restore-keys: |
69+
${{ runner.os }}-build-
70+
71+
- name: Make script executable
72+
run: chmod +x ./scripts/setup_pq.sh
73+
74+
- name: Build and install liboqs-python
75+
run: |
76+
git clone --depth=1 https://github.com/open-quantum-safe/liboqs-python
77+
cd liboqs-python
78+
pip install .
79+
cd ..
80+
81+
82+
basics:
83+
name: Code Style Check
84+
runs-on: ubuntu-latest
85+
needs: unit_tests
86+
steps:
87+
- name: Checkout Code
88+
uses: actions/checkout@v3
89+
90+
- name: Set up Python
91+
uses: actions/setup-python@v3
92+
with:
93+
python-version: 3.11.2
94+
95+
- name: Run Ruff
96+
run: ruff check
97+
98+
license_check:
99+
name: License Check
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: Checkout Code
103+
uses: actions/checkout@v3
104+
105+
- name: Set up Python
106+
uses: actions/setup-python@v3
107+
with:
108+
python-version: 3.11.2
109+
110+
- name: Install Dependencies
111+
run: |
112+
pip install reuse
113+
114+
- name: Run REUSE
115+
run: reuse lint
116+
117+
robot_framework:
118+
name: Robot Framework Code Style
119+
runs-on: ubuntu-latest
120+
needs:
121+
- pylint
122+
- license_check
123+
steps:
124+
- name: Checkout Code
125+
uses: actions/checkout@v3
126+
127+
- name: Set up Python
128+
uses: actions/setup-python@v3
129+
with:
130+
python-version: 3.11.2
131+
132+
- name: Install Robot Framework Robocop
133+
run: pip install robotframework-robocop==5.5.0
134+
135+
- name: Run Robocop
136+
run: robocop --report rules_by_error_type
137+
138+
pylint:
139+
name: Static Analysis with Pylint
140+
runs-on: ubuntu-latest
141+
needs:
142+
- unit_tests
143+
- license_check
144+
steps:
145+
- name: Checkout Code
146+
uses: actions/checkout@v4
147+
148+
- name: Set up Python
149+
uses: actions/setup-python@v4
150+
with:
151+
python-version: 3.11.2
152+
153+
- name: Install Dependencies
154+
run: |
155+
pip install -r requirements-dev.txt
156+
157+
- name: Run Pylint
158+
run: pylint --fail-under=9.70 --disable=W0511 resources
159+
160+
pyright:
161+
name: Static Analysis with Pyright
162+
runs-on: ubuntu-latest
163+
needs:
164+
- install_dependencies
165+
- unit_tests
166+
- license_check
167+
- pylint
168+
steps:
169+
- name: Checkout Code
170+
uses: actions/checkout@v3
171+
172+
- name: Set up Python
173+
uses: actions/setup-python@v3
174+
with:
175+
python-version: 3.11.2
176+
177+
- name: Install Pyright
178+
run: pip install pyright==1.1.389
179+
180+
- name: Run Pyright
181+
run: |
182+
export ERRORS=$(PYTHONPATH=./resources pyright ./resources | tail -n 1 | grep -o '^[0-9]*')
183+
[ -z "$ERRORS" ] && ERRORS=0
184+
[ "$ERRORS" -lt 150 ] 2>/dev/null && echo "Success." || (echo "Failure. Error count:" && exit 1)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Docker Unit tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_and_run:
7+
runs-on: ubuntu-22.04
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v4
11+
12+
- name: Build Docker image
13+
run: |
14+
docker build -t unittest-image -f data/dockerfiles/Dockerfile.unittest .
15+
16+
- name: Run Docker container
17+
run: |
18+
docker run --rm -t --workdir=/app unittest-image
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM ubuntu:22.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y python3 python3-pip python3-venv openssl libssl-dev cmake git && \
5+
apt-get clean
6+
7+
# Set up a virtual environment, because "pip install" is not allowed.
8+
WORKDIR /app
9+
RUN python3 -m venv /app/venv
10+
11+
COPY requirements.txt /app/requirements.txt
12+
RUN /app/venv/bin/pip install --upgrade pip && \
13+
/app/venv/bin/pip install -r /app/requirements.txt
14+
15+
# Build and install liboqs-python
16+
RUN git clone --depth=1 https://github.com/open-quantum-safe/liboqs-python && \
17+
cd liboqs-python && \
18+
/app/venv/bin/pip install . && \
19+
cd ..
20+
21+
RUN openssl version
22+
RUN /app/venv/bin/python3 --version
23+
RUN /app/venv/bin/pip freeze
24+
RUN uname -a
25+
COPY . /app
26+
27+
CMD ["sh", "-c", "PYTHONPATH=./resources /app/venv/bin/python3 -m unittest discover -s unit_tests"]

0 commit comments

Comments
 (0)