Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 162 additions & 0 deletions .github/workflows/accuracy_performance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: PR Evaluation

# NOTE: GitHub-hosted runners are noisy. Latency numbers are indicative only.
# For precise benchmarks, register a self-hosted runner once asap-tools infra
# is decoupled from Cloudlab. See PDF eval guide Phase 3.

on:
pull_request:
branches:
- main
paths:
- 'asap-query-engine/**'
- 'asap-planner-rs/**'
- 'asap-summary-ingest/**'
- 'asap-quickstart/**'
- '.github/workflows/accuracy_performance.yml'
- 'benchmarks/**'
workflow_dispatch:

permissions:
contents: read
packages: write
pull-requests: write

jobs:
# ---------------------------------------------------------------------------
# Job 1: build images once from branch code and push with a SHA-based tag.
# All downstream jobs pull these images instead of rebuilding.
# ---------------------------------------------------------------------------
build:
name: Build CI images
runs-on: ubuntu-latest
outputs:
image-tag: ${{ steps.tag.outputs.value }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Compute image tag
id: tag
run: echo "value=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build and push asap-planner-rs
uses: docker/build-push-action@v6
with:
context: .
file: asap-planner-rs/Dockerfile
push: true
tags: ghcr.io/projectasap/asap-planner-rs:${{ steps.tag.outputs.value }}
cache-from: type=registry,ref=ghcr.io/projectasap/asap-planner-rs:buildcache
cache-to: type=registry,ref=ghcr.io/projectasap/asap-planner-rs:buildcache,mode=max

- name: Build and push asap-summary-ingest
uses: docker/build-push-action@v6
with:
context: asap-summary-ingest
file: asap-summary-ingest/Dockerfile
push: true
tags: ghcr.io/projectasap/asap-summary-ingest:${{ steps.tag.outputs.value }}

- name: Build and push asap-query-engine
uses: docker/build-push-action@v6
with:
context: .
file: asap-query-engine/Dockerfile
push: true
tags: ghcr.io/projectasap/asap-query-engine:${{ steps.tag.outputs.value }}
cache-from: type=registry,ref=ghcr.io/projectasap/asap-query-engine:buildcache
cache-to: type=registry,ref=ghcr.io/projectasap/asap-query-engine:buildcache,mode=max

# ---------------------------------------------------------------------------
# Job 2: pull the images built above, deploy the full stack, and evaluate.
# ---------------------------------------------------------------------------
eval:
name: Full-stack PR evaluation
needs: build
runs-on: ubuntu-latest
timeout-minutes: 60
env:
ASAP_IMAGE_TAG: ${{ needs.build.outputs.image-tag }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull and start full stack
run: |
docker compose \
-f asap-quickstart/docker-compose.yml \
-f benchmarks/docker-compose.yml \
up -d

- name: Show running containers
run: |
docker compose \
-f asap-quickstart/docker-compose.yml \
-f benchmarks/docker-compose.yml \
ps

- name: Wait for all services to be healthy
run: bash benchmarks/scripts/wait_for_stack.sh

- name: Wait for pipeline and data ingestion
run: bash benchmarks/scripts/ingest_wait.sh

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python dependencies
run: pip install requests

- name: Run baseline queries (Prometheus)
run: python benchmarks/scripts/run_baseline.py

- name: Run ASAP queries (query engine)
run: python benchmarks/scripts/run_asap.py

- name: Compare results and evaluate
run: python benchmarks/scripts/compare.py

- name: Upload evaluation reports
if: always()
uses: actions/upload-artifact@v4
with:
name: eval-reports-${{ github.run_id }}
path: benchmarks/reports/

- name: Print docker logs on failure
if: failure()
run: |
docker compose \
-f asap-quickstart/docker-compose.yml \
-f benchmarks/docker-compose.yml \
logs --no-color

- name: Teardown stack
if: always()
run: |
docker compose \
-f asap-quickstart/docker-compose.yml \
-f benchmarks/docker-compose.yml \
down -v
168 changes: 168 additions & 0 deletions .github/workflows/correctness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Correctness Tests

# Verifies cross-language parity between Python and Rust implementations of
# PromQL pattern matching and sketch serialisation. Ephemeral GitHub Actions
# VMs are well-suited for these deterministic correctness checks.

on:
push:
branches: [ main ]
paths:
- 'asap-common/tests/**'
- 'asap-common/dependencies/**'
- 'asap-common/sketch-core/**'
- '.github/workflows/correctness.yml'
pull_request:
branches: [ main ]
paths:
- 'asap-common/tests/**'
- 'asap-common/dependencies/**'
- 'asap-common/sketch-core/**'
- '.github/workflows/correctness.yml'
workflow_dispatch:

jobs:
# ── 1. Cross-language token matching (Python vs Rust) ──────────────────────
cross-language-token-matching:
name: Cross-language PromQL token matching
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
if [ -f asap-common/dependencies/py/requirements.txt ]; then
pip install -r asap-common/dependencies/py/requirements.txt
fi
pip install -e asap-common/dependencies/py/promql_utilities/

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install protoc
run: |
sudo apt-get update -qq
sudo apt-get install -y protobuf-compiler

- name: Run sccache
uses: mozilla-actions/sccache-action@v0.0.4

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-correctness-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}

- name: Run master test runner (Python + Rust + comparison)
working-directory: asap-common/tests/compare_matched_tokens
run: python utilities/master_test_runner.py
env:
RUSTC_WRAPPER: sccache

- name: Upload test artefacts
if: always()
uses: actions/upload-artifact@v4
with:
name: cross-language-token-results
path: |
asap-common/tests/compare_matched_tokens/python_tests/python_test_results.json
asap-common/tests/compare_matched_tokens/rust_tests/rust_test_results.json
asap-common/tests/compare_matched_tokens/comparison_tests/comparison_report.json
asap-common/tests/compare_matched_tokens/test_summary.json
if-no-files-found: warn

# ── 2. Cross-language serialised pattern comparison ────────────────────────
cross-language-pattern-serialisation:
name: Cross-language pattern serialisation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
if [ -f asap-common/dependencies/py/requirements.txt ]; then
pip install -r asap-common/dependencies/py/requirements.txt
fi
pip install -e asap-common/dependencies/py/promql_utilities/

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install protoc
run: |
sudo apt-get update -qq
sudo apt-get install -y protobuf-compiler

- name: Run sccache
uses: mozilla-actions/sccache-action@v0.0.4

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-correctness-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}

- name: Generate Python patterns
working-directory: asap-common/tests/compare_patterns
run: python python_generate_patterns.py

- name: Build and run Rust pattern generator
working-directory: asap-common/tests/compare_patterns
run: cargo run --release
env:
RUSTC_WRAPPER: sccache

- name: Compare serialised patterns
working-directory: asap-common/tests/compare_patterns
run: python compare_serialized_patterns.py

# ── 3. Rust pattern-matching unit tests ────────────────────────────────────
rust-pattern-matching:
name: Rust pattern matching unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install protoc
run: |
sudo apt-get update -qq
sudo apt-get install -y protobuf-compiler

- name: Run sccache
uses: mozilla-actions/sccache-action@v0.0.4

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-correctness-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}

- name: Run Rust pattern matching tests
working-directory: asap-common/tests/rust_pattern_matching
run: cargo test --release
env:
RUSTC_WRAPPER: sccache
1 change: 1 addition & 0 deletions asap-common/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ dependencies/py/promql_utilities/promql_utilities.egg-info/
dependencies/rs/**/target/

tests/**/*.json
!tests/**/test_data/*.json
tests/**/target/
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[workspace]

[package]
name = "promql_cross_lang_tests"
version = "0.1.0"
Expand Down
Loading
Loading