-
Notifications
You must be signed in to change notification settings - Fork 0
Add correctness CI: cross-language PromQL pattern matching parity tests #247
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
Merged
Merged
Changes from all commits
Commits
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,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 |
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
2 changes: 2 additions & 0 deletions
2
asap-common/tests/compare_matched_tokens/rust_tests/Cargo.toml
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 |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| [workspace] | ||
|
|
||
| [package] | ||
| name = "promql_cross_lang_tests" | ||
| version = "0.1.0" | ||
|
|
||
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.