mirror of
https://github.com/trailofbits/buttercup
synced 2026-06-21 14:11:39 +00:00
c47f27debe
* Add bulk loading and update schema * Remove unnecessary config options for speedup * Uncomment unit test. Update integration test. * Fix permission issue with removing temp folder * Update file paths * Changing graphdb directory * Update integration config
137 lines
4.4 KiB
YAML
137 lines
4.4 KiB
YAML
name: Unit tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
prepare-config:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Prepare JanusGraph config
|
|
run: |
|
|
# Create and set permissions for directories
|
|
sudo mkdir -p /tmp_graphdb/
|
|
sudo chmod -R 777 /tmp_graphdb/
|
|
|
|
# Debug: Check source files
|
|
echo "Checking source files:"
|
|
ls -la ${{ github.workspace }}/program-model/conf/
|
|
|
|
# Copy content to files
|
|
sudo cp ${{ github.workspace }}/program-model/conf/schema.json /tmp_graphdb/schema.json
|
|
sudo cp ${{ github.workspace }}/program-model/conf/janusgraph-server.yaml /tmp_graphdb/janusgraph-server.yaml
|
|
sudo chown root:docker /tmp_graphdb/schema.json
|
|
sudo chown root:docker /tmp_graphdb/janusgraph-server.yaml
|
|
|
|
# Debug: Check copied files
|
|
echo "Checking copied files:"
|
|
ls -la /tmp_graphdb/
|
|
|
|
test:
|
|
needs: prepare-config
|
|
strategy:
|
|
matrix:
|
|
component: [common, orchestrator, fuzzer, program-model, seed-gen, patcher]
|
|
python:
|
|
- "3.12"
|
|
include:
|
|
- component: common
|
|
pytest_args: "--runintegration"
|
|
- component: program-model
|
|
pytest_args: "--runintegration"
|
|
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
redis:
|
|
image: redis
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 6379:6379
|
|
graphdb-storage:
|
|
image: cassandra:4.0.6
|
|
options: >-
|
|
--health-cmd "nodetool status"
|
|
--health-interval 10s
|
|
--health-timeout 60s
|
|
--health-retries 4
|
|
env:
|
|
CASSANDRA_START_RPC: true
|
|
ports:
|
|
- 9042:9042
|
|
- 9160:9160
|
|
graphdb:
|
|
image: janusgraph/janusgraph:latest
|
|
options: >-
|
|
--health-cmd "bin/gremlin.sh -e scripts/remote-connect.groovy"
|
|
--health-interval 10s
|
|
--health-timeout 60s
|
|
--health-retries 4
|
|
env:
|
|
JANUSGRAPH_STORAGE_BACKEND: cql
|
|
JANUSGRAPH_STORAGE_HOSTNAME: graphdb-storage
|
|
JANUSGRAPH_STORAGE_CQL_KEYSPACE: janusgraph
|
|
JANUSGRAPH_SCHEMA_INIT_STRATEGY: json
|
|
JANUSGRAPH_SCHEMA_INIT_JSON_FILE: /opt/janusgraph/conf/schema.json
|
|
JANUSGRAPH_QUERY_BATCH: true
|
|
JANUSGRAPH_STORAGE_BATCH_LOADING: true
|
|
_JAVA_OPTIONS: -Xmx4g -Xms2g
|
|
volumes:
|
|
- /crs_scratch:/crs_scratch
|
|
- /tmp_graphdb/schema.json:/opt/janusgraph/conf/schema.json
|
|
# - /tmp_graphdb/janusgraph-server.yaml:/opt/janusgraph/conf/janusgraph-server.yaml
|
|
ports:
|
|
- 8182:8182
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
|
|
- name: Download Wasm runtime
|
|
run: wget https://github.com/vmware-labs/webassembly-language-runtimes/releases/download/python%2F3.12.0%2B20231211-040d5a6/python-3.12.0.wasm
|
|
if: ${{ matrix.component }} == 'seed-gen'
|
|
working-directory: seed-gen
|
|
|
|
- name: Install ripgrep
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y ripgrep
|
|
if: ${{ matrix.component }} == 'seed-gen'
|
|
working-directory: seed-gen
|
|
|
|
- name: Prepare Kythe and JanusGraph
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
run: |
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
sudo apt-get update
|
|
sudo apt-get install -y codequery
|
|
sudo mkdir -p /crs_scratch
|
|
sudo chmod -R 777 /crs_scratch
|
|
sudo apt-get install -y just
|
|
echo ${{ env.GH_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin
|
|
just download-kythe
|
|
if: ${{ matrix.component }} == 'program-model'
|
|
working-directory: program-model
|
|
|
|
- name: Setup ${{ matrix.component }} component
|
|
run: |
|
|
uv sync --all-extras
|
|
working-directory: ${{ matrix.component }}
|
|
|
|
- name: Run tests on ${{ matrix.component }} component
|
|
run: uv run pytest -svv ${{ matrix.pytest_args }}
|
|
env:
|
|
PYTHON_WASM_BUILD_PATH: "python-3.12.0.wasm"
|
|
working-directory: ${{ matrix.component }} |