fix config restoration #166
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
| name: CI Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| pre-commit-run: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Run pre-commit | |
| run: pre-commit run --verbose --all-files | |
| security: | |
| runs-on: ubuntu-latest | |
| container: python:3.12-slim | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| pip install -e ".[dev]" | |
| - name: Security Checks | |
| run: | | |
| bandit --severity-level high . | |
| pytests: | |
| runs-on: ubuntu-latest | |
| container: python:3.12-slim | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| pip install -e ".[test]" | |
| TORCH_VERSION=$(python -c "import torch; print(torch.__version__.split('+')[0])") | |
| pip install torch-scatter -f "https://data.pyg.org/whl/torch-${TORCH_VERSION}+cpu.html" | |
| - name: Unit tests | |
| run: | | |
| pytest --cov=. tests/ | |
| detect_secrets: | |
| name: IBM detect-secrets | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install prerequisites | |
| run: sudo apt-get update && sudo apt-get install -y jq diffutils | |
| - name: Install IBM detect-secrets | |
| run: | | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets" | |
| python3 -m pip install boxsdk | |
| - name: Scan repository & write snapshot | |
| run: | | |
| mkdir -p security-outputs | |
| # Run detect-secrets while skipping binary files | |
| detect-secrets scan \ | |
| --exclude-files '.*\.ipynb$|.*\.(png|jpg|jpeg|gif|pdf|onnx|pt|pth|bin|zip)$' \ | |
| --exclude-lines '"(outputs|image/\w+|id|hash)":.*' \ | |
| --force-use-all-plugins \ | |
| . \ | |
| > security-outputs/ds-results.json \ | |
| 2> security-outputs/.secrets.new || true | |
| - name: Upload scan artifacts (for triage) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: detect-secrets-artifacts | |
| path: .secrets.new | |
| codeql: | |
| name: CodeQL (Python) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: github/codeql-action/init@v3 | |
| with: | |
| languages: python | |
| - uses: github/codeql-action/autobuild@v3 | |
| - uses: github/codeql-action/analyze@v3 | |
| with: | |
| category: "/language:python" | |
| #semgrep: | |
| # name: Semgrep (p/default + local overrides) | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Install Semgrep | |
| # run: pip install semgrep | |
| # - name: Semgrep scan (PR diff-aware) | |
| # if: ${{ github.event_name == 'pull_request' }} | |
| # run: | | |
| # semgrep \ | |
| # --config=p/default \ | |
| # --config=.semgrep.yaml \ | |
| # --error \ | |
| # --baseline-commit "${{ github.event.pull_request.base.sha }}" \ | |
| # . | |
| # - name: Semgrep scan (full) | |
| # if: ${{ github.event_name != 'pull_request' }} | |
| # run: | | |
| # semgrep \ | |
| # --config=p/default \ | |
| # --config=.semgrep.yaml \ | |
| # --error \ | |
| bandit: | |
| name: Bandit (Python) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Bandit | |
| run: pip install bandit | |
| - name: Run Bandit | |
| run: bandit -ll -ii -r gridfm-graphkit -f json -o bandit-report.json | |
| - name: Upload artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bandit-report | |
| path: bandit-report.json | |
| pip_audit: | |
| name: pip-audit (deps) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install package (editable) and dev/test extras if present | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev,test] || pip install -e . | |
| - name: Run pip-audit | |
| uses: pypa/gh-action-pip-audit@v1.1.0 | |
| with: | |
| # CVE-2026-4539: pygments AdlLexer ReDoS, local-only attack vector, no fix released yet | |
| ignore-vulns: CVE-2026-4539 | |
| trivy_repo: | |
| name: Trivy (repo scan) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Trivy vulnerability scanner in repo mode | |
| # We use the official container-based action to avoid binary install issues | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| ignore-unfixed: true | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| severity: 'HIGH,CRITICAL' | |
| - name: Upload SARIF to Code Scanning | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() # Upload results even if vulnerabilities are found | |
| with: | |
| sarif_file: 'trivy-results.sarif' |