|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, feat/* ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + build_liboqs: |
| 11 | + description: Build liboqs from source before running tests |
| 12 | + required: false |
| 13 | + default: false |
| 14 | + type: boolean |
| 15 | + |
| 16 | +jobs: |
| 17 | + test: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + env: |
| 20 | + OQS_INSTALL_PATH: /usr/local |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Python |
| 26 | + uses: actions/setup-python@v4 |
| 27 | + with: |
| 28 | + python-version: '3.12' |
| 29 | + |
| 30 | + - name: Install system deps |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y build-essential cmake libssl-dev pkg-config |
| 34 | + |
| 35 | + - name: Optionally build liboqs |
| 36 | + if: github.event_name == 'workflow_dispatch' && inputs.build_liboqs || vars.BUILD_LIBOQS == 'true' |
| 37 | + run: | |
| 38 | + git clone --depth 1 https://github.com/open-quantum-safe/liboqs.git /tmp/liboqs |
| 39 | + mkdir -p /tmp/liboqs/build && cd /tmp/liboqs/build |
| 40 | + cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local .. |
| 41 | + make -j$(nproc) |
| 42 | + sudo make install |
| 43 | + sudo ldconfig |
| 44 | + python -m pip install liboqs-python |
| 45 | + |
| 46 | + - name: Install Python deps |
| 47 | + run: | |
| 48 | + python -m pip install --upgrade pip |
| 49 | + pip install -r prototype/requirements.txt |
| 50 | + pip install bandit safety pre-commit |
| 51 | + |
| 52 | + - name: Run security scan (Bandit) |
| 53 | + run: | |
| 54 | + bandit -r prototype/ --exit-zero -f json -o bandit-report.json |
| 55 | + echo "Bandit report saved to bandit-report.json" |
| 56 | + |
| 57 | + - name: Check for vulnerable dependencies (Safety) |
| 58 | + run: | |
| 59 | + safety check --json > security-report.json || true |
| 60 | + echo "Safety report saved to security-report.json" |
| 61 | + |
| 62 | + - name: Run repository hygiene hooks |
| 63 | + run: | |
| 64 | + pre-commit run check-yaml --all-files |
| 65 | + pre-commit run check-json --all-files |
| 66 | + pre-commit run check-added-large-files --all-files |
| 67 | + |
| 68 | + - name: Run tests |
| 69 | + run: | |
| 70 | + pytest -q prototype/test_security_fixes.py prototype/test_oqs_hybrid.py prototype/test_secure_hybrid_integration.py prototype/test_concurrency_smoke.py prototype/test_secure_run.py -v |
| 71 | + |
| 72 | + - name: Upload security reports |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: security-reports |
| 76 | + path: | |
| 77 | + bandit-report.json |
| 78 | + security-report.json |
| 79 | +
|
| 80 | + build: |
| 81 | + needs: test |
| 82 | + runs-on: ubuntu-latest |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + |
| 86 | + - name: Build Docker images |
| 87 | + run: | |
| 88 | + docker compose -f docker-compose.dev.yml build |
0 commit comments