-
Notifications
You must be signed in to change notification settings - Fork 759
Build script to build liboqs #2417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
charishma1407
wants to merge
51
commits into
open-quantum-safe:main
from
charishma1407:charishma_build_script
+997
−0
Closed
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
3ddb793
Build script to build liboqs
1758d64
Add CI testing for build_liboqs.sh script
0832ee6
Update workflow to test on charishma_build_script branch
8522e7a
Fix syntax error in workflow - use bash-compatible syntax
213c244
Optimize CI workflow to reduce compute cycles
84ebdc2
Fix YAML syntax error in workflow file
e8f3cf3
Fix missing fi in workflow test step
4fb5840
Stale code check with CMake options
1f1933a
Removed detect-outdated-script job from yml as now stale check is bas…
9c055e7
Fixed yml errors
2ef9b3d
Removed staleness check for the workflow to resolve the error in ubuntu
314b294
Ubuntu error check
c7b206b
Fixed --help check from workflow
01b9523
Moved stale check to the end of the routine
90e151c
Node js annotation warning for workflow
a115f91
Updated README.md for PR test workflow
d7d7356
1. Added a test case for macos in Workflow
a22b436
Removed the build_script branch from yml file
e46f047
1.Pip installation without break system packages
7c9d7d3
Actions test build fix
6712330
Actions test build fix
623f0eb
Actions test build fix for macos
c9c0c50
Build script to build liboqs
8f3d1da
Add CI testing for build_liboqs.sh script
f7ab769
Update workflow to test on charishma_build_script branch
710efd8
Fix syntax error in workflow - use bash-compatible syntax
751e363
Optimize CI workflow to reduce compute cycles
829e8a0
Fix YAML syntax error in workflow file
4d5e22d
Fix missing fi in workflow test step
22e9d15
Stale code check with CMake options
43eb398
Removed detect-outdated-script job from yml as now stale check is bas…
751ff77
Fixed yml errors
ff5d34f
Removed staleness check for the workflow to resolve the error in ubuntu
f67aa68
Ubuntu error check
cf7a4b9
Fixed --help check from workflow
9c405c6
Moved stale check to the end of the routine
dc406fe
Node js annotation warning for workflow
76a211d
Updated README.md for PR test workflow
24a4947
1. Added a test case for macos in Workflow
fe8b331
Removed the build_script branch from yml file
8630d4c
1.Pip installation without break system packages
bdde755
Actions test build fix
04aa2dc
Actions test build fix
9f9e72f
Modified the script as per comments
c2987d0
Removed build only mode from CI test
d95459f
docs: regenerate README.md algorithm support table
38c088b
docs: add build script section to README and sync algorithm table
554b628
docs: fix Doxygen 'explicit link to what' error in README.md
fd62395
Doxygen code formatting issue
f3e5031
README update on support algorithms
27d47bd
Merge branch 'main' into charishma_build_script
charishma1407 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,271 @@ | ||
| name: Build Script Test | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main,charishma_build_script ] | ||
| paths: | ||
| - 'build_liboqs.sh' | ||
| - 'requirements.txt' | ||
| - 'CMakeLists.txt' | ||
| - 'src/**/CMakeLists.txt' | ||
| - '.github/workflows/build-script-test.yml' | ||
| pull_request: | ||
| paths: | ||
| - 'build_liboqs.sh' | ||
| - 'requirements.txt' | ||
| - 'CMakeLists.txt' | ||
| - 'src/**/CMakeLists.txt' | ||
| - '.github/workflows/build-script-test.yml' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test-build-script: | ||
| name: Test build script on ${{ matrix.os }} - ${{ matrix.test-name }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| # Essential Ubuntu tests - covers core functionality | ||
| - os: ubuntu-latest | ||
| test-name: default-build | ||
| script-args: "" | ||
| description: "Default configuration (most common use case)" | ||
|
|
||
| - os: ubuntu-latest | ||
| test-name: minimal-build | ||
| script-args: '--minimal-build "KEM_ml_kem_768;SIG_ml_dsa_44"' | ||
| description: "Minimal build with specific algorithms" | ||
| test-kem-alg: "ML-KEM-768" | ||
| test-sig-alg: "ML-DSA-44" | ||
|
|
||
| - os: ubuntu-latest | ||
| test-name: shared-no-openssl | ||
| script-args: "--shared --no-openssl" | ||
| description: "Shared library without OpenSSL" | ||
|
|
||
| # Cross-platform verification - macOS tests | ||
| - os: macos-latest | ||
| test-name: default-build | ||
| script-args: "" | ||
| description: "Verify script works on macOS" | ||
|
|
||
| - os: macos-latest | ||
| test-name: minimal-build-multi-alg | ||
| script-args: '--minimal-build "KEM_ml_kem_512;KEM_ml_kem_768;KEM_ml_kem_1024;SIG_ml_dsa_44;SIG_ml_dsa_65;SIG_falcon_512"' | ||
| description: "Minimal build with multiple algorithms on macOS" | ||
| test-kem-alg: "ML-KEM-768" | ||
| test-sig-alg: "ML-DSA-44" | ||
|
|
||
| # NixOS test - verify Nix flake integration | ||
| - os: ubuntu-latest | ||
| test-name: nixos-flake | ||
| script-args: "" | ||
| description: "Test NixOS/Nix flake integration" | ||
| use-nix: true | ||
|
|
||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2 | ||
|
|
||
| - name: Install Nix (for NixOS tests) | ||
| if: matrix.use-nix == true | ||
| uses: nixbuild/nix-quick-install-action@v28 | ||
Check warningCode scanning / Scorecard Pinned-Dependencies Medium
score is 9: third-party GitHubAction not pinned by hash
Click Remediation section below to solve this issue Check noticeCode scanning / poutine Github Action from Unverified Creator used Note
Usage of the following GitHub Actions repositories was detected in workflows
or composite actions, but their owner is not a verified creator. |
||
|
|
||
| with: | ||
| nix_conf: | | ||
| experimental-features = nix-command flakes | ||
|
|
||
| - name: Make build script executable | ||
| run: chmod +x build_liboqs.sh | ||
|
|
||
| - name: Run build script - ${{ matrix.test-name }} (NixOS) | ||
| if: matrix.use-nix == true | ||
| env: | ||
| SKIP_STALENESS_CHECK: 1 | ||
| run: | | ||
| # Simulate NixOS by unsetting IN_NIX_SHELL to test auto-detection | ||
| unset IN_NIX_SHELL | ||
| # The script should automatically re-execute itself with 'nix develop -c' | ||
| ./build_liboqs.sh ${{ matrix.script-args }} | ||
|
|
||
| - name: Run build script - ${{ matrix.test-name }} (non-NixOS) | ||
| if: matrix.use-nix != true | ||
| env: | ||
| SKIP_STALENESS_CHECK: 1 | ||
| run: ./build_liboqs.sh ${{ matrix.script-args }} | ||
|
|
||
| - name: Verify build artifacts exist | ||
| run: | | ||
| if [ ! -d "build" ]; then | ||
| echo "Error: build directory not created" | ||
| exit 1 | ||
| fi | ||
| if [ ! -f "build/lib/liboqs.a" ] && [ ! -f "build/lib/liboqs.dylib" ] && [ ! -f "build/lib/liboqs.so" ]; then | ||
| echo "Error: liboqs library not found" | ||
| exit 1 | ||
| fi | ||
| echo "✓ Build artifacts verified" | ||
|
|
||
| - name: Run basic library test | ||
| run: | | ||
| cd build | ||
| # Check if test executables exist and run a quick test | ||
| if [ -f "tests/test_kem" ]; then | ||
| echo "Running KEM test..." | ||
| # Use specified algorithm if provided, otherwise auto-detect | ||
| if [ -n "${{ matrix.test-kem-alg }}" ]; then | ||
| KEM_ALG="${{ matrix.test-kem-alg }}" | ||
| echo "Testing with specified algorithm: $KEM_ALG" | ||
| else | ||
| # Get list of available algorithms and pick the first one | ||
| KEM_ALG=$(./tests/test_kem 2>&1 | grep "algname:" | sed 's/.*algname: //' | cut -d',' -f1 | tr -d ' ') | ||
| echo "Testing with first available algorithm: $KEM_ALG" | ||
| fi | ||
|
|
||
| if [ -n "$KEM_ALG" ]; then | ||
| ./tests/test_kem "$KEM_ALG" | ||
| echo "✓ KEM test passed with $KEM_ALG" | ||
| else | ||
| echo "⚠ Could not determine available KEM algorithms" | ||
| fi | ||
| else | ||
| echo "KEM test executable not found (may be disabled in minimal build)" | ||
| fi | ||
|
|
||
| if [ -f "tests/test_sig" ]; then | ||
| echo "Running SIG test..." | ||
| # Use specified algorithm if provided, otherwise auto-detect | ||
| if [ -n "${{ matrix.test-sig-alg }}" ]; then | ||
| SIG_ALG="${{ matrix.test-sig-alg }}" | ||
| echo "Testing with specified algorithm: $SIG_ALG" | ||
| else | ||
| # Get list of available algorithms and pick the first one | ||
| SIG_ALG=$(./tests/test_sig 2>&1 | grep "algname:" | sed 's/.*algname: //' | cut -d',' -f1 | tr -d ' ') | ||
| echo "Testing with first available algorithm: $SIG_ALG" | ||
| fi | ||
|
|
||
| if [ -n "$SIG_ALG" ]; then | ||
| ./tests/test_sig "$SIG_ALG" | ||
| echo "✓ SIG test passed with $SIG_ALG" | ||
| else | ||
| echo "⚠ Could not determine available SIG algorithms" | ||
| fi | ||
| else | ||
| echo "SIG test executable not found (may be disabled in minimal build)" | ||
| fi | ||
|
|
||
| test-script-options-coverage: | ||
| name: Verify script covers all CMake options | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2 | ||
|
|
||
| - name: Extract CMake options from CONFIGURE.md | ||
| run: | | ||
| # Extract OQS_ prefixed options from CONFIGURE.md | ||
| grep -oE 'OQS_[A-Z_]+' CONFIGURE.md | sort -u > cmake_options.txt || true | ||
| echo "CMake options found in CONFIGURE.md:" | ||
| cat cmake_options.txt | ||
|
|
||
| - name: Extract options from build script | ||
| run: | | ||
| # Extract OQS_ prefixed options from build_liboqs.sh | ||
| grep -oE 'OQS_[A-Z_]+' build_liboqs.sh | sort -u > script_options.txt || true | ||
| echo "Options found in build_liboqs.sh:" | ||
| cat script_options.txt | ||
|
|
||
| - name: Compare coverage | ||
| shell: bash | ||
| run: | | ||
| echo "Checking if build script covers major CMake options..." | ||
| # Check for key options that should be in the script (using word boundaries to avoid partial matches) | ||
| echo "Checking for OQS_USE_OPENSSL..." | ||
| if grep -qE '\bOQS_USE_OPENSSL\b' build_liboqs.sh; then | ||
| echo "✓ Found: OQS_USE_OPENSSL" | ||
| else | ||
| echo "❌ Missing: OQS_USE_OPENSSL" | ||
| fi | ||
|
|
||
| echo "Checking for OQS_DIST_BUILD..." | ||
| if grep -qE '\bOQS_DIST_BUILD\b' build_liboqs.sh; then | ||
| echo "✓ Found: OQS_DIST_BUILD" | ||
| else | ||
| echo "❌ Missing: OQS_DIST_BUILD" | ||
| fi | ||
|
|
||
| echo "Checking for OQS_MINIMAL_BUILD..." | ||
| if grep -qE '\bOQS_MINIMAL_BUILD\b' build_liboqs.sh; then | ||
| echo "✓ Found: OQS_MINIMAL_BUILD" | ||
| else | ||
| echo "❌ Missing: OQS_MINIMAL_BUILD" | ||
| fi | ||
|
|
||
| echo "Checking for OQS_BUILD_ONLY_LIB..." | ||
| if grep -qE '\bOQS_BUILD_ONLY_LIB\b' build_liboqs.sh; then | ||
| echo "✓ Found: OQS_BUILD_ONLY_LIB" | ||
| else | ||
| echo "❌ Missing: OQS_BUILD_ONLY_LIB" | ||
| fi | ||
|
|
||
| echo "Checking for OQS_ALGS_ENABLED..." | ||
| if grep -qE '\bOQS_ALGS_ENABLED\b' build_liboqs.sh; then | ||
| echo "✓ Found: OQS_ALGS_ENABLED" | ||
| else | ||
| echo "❌ Missing: OQS_ALGS_ENABLED" | ||
| fi | ||
|
|
||
| echo "✓ Coverage check complete" | ||
|
|
||
| test-script-help: | ||
| name: Verify script help and usage | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2 | ||
|
|
||
| - name: Make build script executable | ||
| run: chmod +x build_liboqs.sh | ||
|
|
||
| - name: Test help flag | ||
| run: | | ||
| ./build_liboqs.sh --help > help_output.txt 2>&1 | ||
| if [ ! -s help_output.txt ]; then | ||
| echo "Error: Help output is empty" | ||
| exit 1 | ||
| fi | ||
| echo "✓ Help flag works" | ||
| cat help_output.txt | ||
|
|
||
| - name: Test invalid option handling | ||
| run: | | ||
| if ./build_liboqs.sh --invalid-option 2>&1 | grep -q "Unknown option"; then | ||
| echo "✓ Invalid option handling works" | ||
| else | ||
| echo "Error: Script should reject invalid options" | ||
| exit 1 | ||
| fi | ||
|
|
||
| test-script-syntax: | ||
| name: Verify script syntax and shellcheck | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2 | ||
|
|
||
| - name: Install shellcheck | ||
| run: sudo apt-get update && sudo apt-get install -y shellcheck | ||
|
|
||
| - name: Check bash syntax | ||
| run: bash -n build_liboqs.sh | ||
|
|
||
| - name: Run shellcheck | ||
| run: | | ||
| shellcheck build_liboqs.sh || echo "Shellcheck warnings found (non-blocking)" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.