-
Notifications
You must be signed in to change notification settings - Fork 0
249 lines (237 loc) · 7.24 KB
/
Copy pathci.yaml
File metadata and controls
249 lines (237 loc) · 7.24 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: CI
on:
push:
branches:
- main
pull_request: {}
workflow_dispatch: {}
concurrency:
# on main, group = workflow-run_id
# on PR, group = workflow-PR_number
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
permissions:
contents: read
checks: write
steps:
############ Setup ############
- name: Repo checkout
uses: actions/checkout@v7
- name: Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.89.0
components: rustfmt, clippy
cache-workspaces: |
jix
jix-macros
jix/schema
jix-py
- uses: taiki-e/install-action@cargo-hack
- uses: actions/setup-python@v7
with:
python-version: 3.13
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.13
activate-environment: true
- name: Install Python dependencies
run: |
python -m ensurepip
uv pip install -r scripts/dev_requirements.txt
- name: Install Protoc
uses: arduino/setup-protoc@v3
############ Format ############
- name: Format jix-schema
run: cargo fmt --all -- --check
working-directory: jix/schema
- name: Format jix-macros
run: cargo fmt --all -- --check
working-directory: jix-macros
- name: Format jix
run: cargo fmt --all -- --check
working-directory: jix
- name: Format jix-py (cargo)
run: cargo fmt --all -- --check
working-directory: jix-py
- name: Format jix-py (ruff)
uses: astral-sh/ruff-action@v3
with:
args: --config .ruff.toml format --check --diff
version: 0.16.x
- name: Check only ASCII
run: python scripts/check_only_ascii.py
############ Build ############
- name: Build jix-schema
run: cargo build
working-directory: jix/schema
env:
RUSTFLAGS: "-D warnings"
- name: Build jix-macros
run: cargo build
working-directory: jix-macros
env:
RUSTFLAGS: "-D warnings"
- name: Build jix
run: cargo build
working-directory: jix
env:
RUSTFLAGS: "-D warnings"
- name: Build jix-py
run: cargo build
working-directory: jix-py
env:
RUSTFLAGS: "-D warnings"
# cargo check with feature powerset
- name: cargo check jix with feature powerset
run: cargo hack check --feature-powerset --depth 2
working-directory: jix
env:
RUSTFLAGS: "-D warnings"
# install jix-py into venv
- name: install jix-py
uses: PyO3/maturin-action@v1
with:
command: develop
args: --uv
sccache: "true"
working-directory: jix-py
############ Docs ############
- name: jix docs
run: cargo doc
working-directory: jix
- name: jix-py docs pyi
run: cargo run --bin generate_pyi
working-directory: jix-py
- name: jix-py docs mkdocs
run: mkdocs build --strict
working-directory: jix-py
############ Linters ############
- name: Clippy jix-schema
run: cargo clippy --all-features
working-directory: jix/schema
env:
RUSTFLAGS: "-D warnings"
- name: Clippy jix-macros
run: cargo clippy --all-features
working-directory: jix-macros
env:
RUSTFLAGS: "-D warnings"
- name: Clippy jix
run: cargo clippy --all-features
working-directory: jix
env:
RUSTFLAGS: "-D warnings"
- name: Clippy jix-py
run: cargo clippy --all-features
working-directory: jix-py
env:
RUSTFLAGS: "-D warnings"
- name: Ruff jix-py
uses: astral-sh/ruff-action@v3
with:
args: --config .ruff.toml check
version: 0.16.x
# - name: Check schema is up to date
# run: |
# pushd schema; cargo run; popd
# git diff --exit-code
# working-directory: jix
- name: Protobuf Buf linter
uses: bufbuild/buf-action@v1
with:
version: 1.71.0
input: jix/schema/proto
format: true
lint: true
breaking: false
push: false
archive: false
pr_comment: false
############ Tests ############
- name: Test jix-macros
run: cargo test
working-directory: jix-macros
env:
RUSTFLAGS: "-D warnings"
- name: Test jix
run: cargo test --all-features
working-directory: jix
env:
RUSTFLAGS: "-D warnings"
- name: Test jix-py (Rust tests)
run: cargo test --all-features --all-targets
working-directory: jix-py
env:
RUSTFLAGS: "-D warnings"
- name: Test jix-py (Python tests)
run: pytest python/tests --numprocesses auto
working-directory: jix-py
- name: Install benchmark dependencies
run: uv pip install -r jix-py/python/benches/requirements.txt
- name: Test bench harness
run: pytest python/benches/tests --numprocesses auto
working-directory: jix-py
- name: Test bench compare
run: pytest scripts/tests --numprocesses auto
rust-version-check-clippy:
# check that we can build using different rust versions:
# - the minimal rust version that is specified by this crate
# - the latest stable version
runs-on: ubuntu-latest
strategy:
matrix:
rust-version: ["msrv", "stable"]
steps:
- uses: actions/checkout@v7
- name: Install toml-cli using cargo
uses: baptiste0928/cargo-install@v3
with:
crate: toml-cli
version: "^0.2"
- name: Determine Rust version
id: rust-version
run: |
if [ "${{ matrix.rust-version }}" = "stable" ]; then
rust_version="stable"
else
rust_version=$(toml get Cargo.toml package.rust-version --raw)
fi
echo "Rust version: '$rust_version'"
echo "rust_version=$rust_version" >> "$GITHUB_OUTPUT"
working-directory: jix
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.rust-version.outputs.rust_version }}
components: clippy
cache-workspaces: |
jix
jix-py
- name: cargo check jix
run: cargo check --all-features
working-directory: jix
env:
RUSTFLAGS: "-D warnings"
- name: cargo clippy jix
run: cargo clippy --all-features
working-directory: jix
env:
RUSTFLAGS: "-D warnings"
- name: cargo check jix-py
run: cargo check --all-features
working-directory: jix-py
env:
RUSTFLAGS: "-D warnings"
- name: cargo clippy jix-py
run: cargo clippy --all-features
working-directory: jix-py
env:
RUSTFLAGS: "-D warnings"