Repository navigation
151 lines (128 loc) · 4.76 KB
/
Copy pathrust.yml
File metadata and controls
151 lines (128 loc) · 4.76 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
name: Rust CI
on:
push:
branches: [ main ]
paths:
- 'crates/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/rust.yml'
# The devtools viewer_contract test validates the viewer's operator-kind contract.
- 'tools/dag-viewer/**'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'crates/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/rust.yml'
# The devtools viewer_contract test validates the viewer's operator-kind contract.
- 'tools/dag-viewer/**'
workflow_dispatch:
concurrency:
# A delayed draft synchronize event must not cancel ready-for-review tests.
group: ${{ github.workflow }}-${{ github.ref }}-draft-${{ github.event.pull_request.draft }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
format-and-lint:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Run sccache-cache
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-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
env:
RUSTC_WRAPPER: sccache
# A deployment runtime uses only the facade's and the executor's public
# APIs. asap-planner's tests check that, but only when the executor links
# without its `test-support` feature, which a workspace build turns on.
- name: Check the runtime tests against the public APIs alone
run: cargo check -p asap-planner --tests --locked
env:
RUSTC_WRAPPER: sccache
test:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Free disk space
# cargo test --workspace links dozens of arrow/datafusion-heavy test
# binaries; the runner's ~14GB of free disk (the rest is preinstalled
# SDKs we don't need) isn't enough headroom and linking dies with
# "ld terminated with signal 7 [Bus error]" once it fills up.
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
df -h /
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Run sccache-cache
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-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
- name: Run all workspace tests
run: cargo test --workspace --locked
env:
RUSTC_WRAPPER: sccache
# The viewer's Python tests run its JavaScript in V8 through py_mini_racer;
# the ones that plan a query run target/debug/stage_pipeline, which the
# workspace test build above already linked for devtools' tests.
# A pinned Python and Node: the runner's system Python refuses a global
# pip install (PEP 668).
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Run the DAG viewer's Python tests
working-directory: tools/dag-viewer
run: |
python3 -m pip install py-mini-racer==0.6.0
python3 -m unittest -v test_viewer test_server
- name: Run the DAG viewer's Node tests
run: node --test tools/dag-viewer/stages.test.mjs
# A PromQL-only runtime builds asap-planner without DataFusion or MetricsQL.
- name: Check and test asap-planner with the PromQL frontend alone
run: |
cargo check -p asap-planner --no-default-features --features promql --locked
cargo test -p asap-planner --no-default-features --features promql --locked
env:
RUSTC_WRAPPER: sccache
- name: Verify MetricsQL frontend as a stable external dependency
run: bash tools/verify_metricsql_external_consumer.sh
env:
RUSTC_WRAPPER: sccache
- name: Verify vendored MetricsQL parser baseline
run: python3 tools/verify_metricsql_vendored_baseline.py
env:
RUSTC_WRAPPER: sccache