-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (143 loc) · 5.63 KB
/
correctness.yml
File metadata and controls
170 lines (143 loc) · 5.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
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:
types: [opened, synchronize, reopened, ready_for_review]
branches: [ main ]
paths:
- 'asap-common/tests/**'
- 'asap-common/dependencies/**'
- 'asap-common/sketch-core/**'
- '.github/workflows/correctness.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── 1. Cross-language token matching (Python vs Rust) ──────────────────────
cross-language-token-matching:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
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:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
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:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
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') }}