mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-04 00:02:01 -04:00
122 lines
3.7 KiB
YAML
122 lines
3.7 KiB
YAML
name: kem benchmark
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Checkout repository
|
|
- name: Checkout repository
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# Set up dependencies
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y cmake ninja-build gcc g++ python3 python3-pip
|
|
sudo apt-get install -y python3-cpuinfo
|
|
|
|
# Build the speed_kem binary only
|
|
- name: Build speed_kem binary
|
|
run: |
|
|
mkdir -p build
|
|
cd build
|
|
cmake -GNinja .. -DBUILD_SHARED_LIBS=OFF
|
|
ninja speed_kem
|
|
|
|
# Copy the parse_liboqs_speed.py script
|
|
- name: Copy parse_liboqs_speed.py
|
|
run: |
|
|
cp scripts/parse_liboqs_speed.py build/tests/
|
|
|
|
# Upload the built binary and script as an artifact
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@6027e3dd177782cd8ab9af838c04fd81a07f1d47
|
|
with:
|
|
name: built-binary
|
|
path: build/tests/
|
|
|
|
benchmark:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
strategy:
|
|
matrix:
|
|
algorithm: [ # List of available KEMs to perform the benchmarking on
|
|
"BIKE-L1",
|
|
"BIKE-L3",
|
|
"BIKE-L5",
|
|
"Classic-McEliece-348864",
|
|
"Classic-McEliece-348864f",
|
|
"Classic-McEliece-460896",
|
|
"Classic-McEliece-460896f",
|
|
"Classic-McEliece-6688128",
|
|
"Classic-McEliece-6688128f",
|
|
"Classic-McEliece-6960119",
|
|
"Classic-McEliece-6960119f",
|
|
"Classic-McEliece-8192128",
|
|
"Classic-McEliece-8192128f",
|
|
"Kyber512",
|
|
"Kyber768",
|
|
"Kyber1024",
|
|
"ML-KEM-512",
|
|
"ML-KEM-768",
|
|
"ML-KEM-1024",
|
|
"sntrup761",
|
|
"FrodoKEM-640-AES",
|
|
"FrodoKEM-640-SHAKE",
|
|
"FrodoKEM-976-AES",
|
|
"FrodoKEM-976-SHAKE",
|
|
"FrodoKEM-1344-AES",
|
|
"FrodoKEM-1344-SHAKE"
|
|
]
|
|
max-parallel: 1 # No parallel jobs to not compromise the pull-push operations of the benchmarking actions below
|
|
|
|
steps:
|
|
# Ensure the repository is checked out
|
|
- name: Checkout repository
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# Download the built binary and script
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # pin@v4
|
|
with:
|
|
name: built-binary
|
|
path: build/tests/
|
|
|
|
# Set execute permissions for the binary
|
|
- name: Set execute permissions
|
|
run: chmod +x build/tests/speed_kem
|
|
|
|
# Run speed_kem tests for each algorithm
|
|
- name: Run speed_kem tests
|
|
run: |
|
|
cd build/tests
|
|
./speed_kem "${{matrix.algorithm}}" > ${{matrix.algorithm}}_output.txt
|
|
python3 parse_liboqs_speed.py ${{matrix.algorithm}}_output.txt --algorithm ${{matrix.algorithm}}
|
|
|
|
# Push to GitHub pages using continuous-benchmark
|
|
- name: Store benchmark result
|
|
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7
|
|
with:
|
|
name: ${{matrix.algorithm}}
|
|
tool: "customSmallerIsBetter"
|
|
output-file-path: build/tests/${{matrix.algorithm}}_formatted.json
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
auto-push: true
|
|
comment-on-alert: true
|
|
summary-always: true
|
|
alert-threshold: 105%
|
|
comment-always: false
|