-
Notifications
You must be signed in to change notification settings - Fork 86
114 lines (98 loc) · 3.34 KB
/
rust_test.yml
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
name: Run Rust CI
# Our Rust code depends on the vendored `orjson` and `pyo3` workspaces,
# so ensure that CI re-runs if they are modified.
on:
push:
branches:
- main
paths:
- "rust/**"
- "vendor/orjson/**"
- "vendor/pyo3/**"
- ".github/workflows/rust_test.yml"
pull_request:
paths:
- "rust/**"
- "vendor/orjson/**"
- "vendor/pyo3/**"
- ".github/workflows/rust_test.yml"
workflow_dispatch:
permissions:
contents: read
env:
RUST_VERSION: '1.82' # Be careful, "stable" gets you "whatever GitHub ships", which is quite old.
RUST_WORKSPACE_PATH: 'rust' # The location of the Rust workspace relative to the repo root.
jobs:
lint:
name: Check lint and rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "${{env.RUST_VERSION}}"
components: rustfmt, clippy
cache-workspaces: "${{env.RUST_WORKSPACE_PATH}} -> target"
rustflags: ""
- name: cargo clippy
working-directory: ${{env.RUST_WORKSPACE_PATH}}
run: cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings --allow deprecated
- name: cargo fmt
working-directory: ${{env.RUST_WORKSPACE_PATH}}
run: cargo fmt -- --check
- name: cargo doc
working-directory: ${{env.RUST_WORKSPACE_PATH}}
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --workspace --no-deps --document-private-items
cargo-test:
name: Run `cargo test`
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "${{env.RUST_VERSION}}"
cache-workspaces: "${{env.RUST_WORKSPACE_PATH}} -> target"
rustflags: ""
- name: cargo test
working-directory: ${{env.RUST_WORKSPACE_PATH}}
run: |
set -euxo pipefail
# We exclude `langsmith-pyo3` since its tests:
# - Have to be run under `nextest`, since they require one-process-per-test.
# - Require a non-default configuration in order to run.
cargo test --workspace --exclude langsmith-pyo3 --all-features
langsmith-pyo3-tests:
name: Run langsmith-pyo3 tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "${{env.RUST_VERSION}}"
cache-workspaces: "${{env.RUST_WORKSPACE_PATH}} -> target"
rustflags: ""
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: cargo test
working-directory: "${{env.RUST_WORKSPACE_PATH}}/crates/langsmith-pyo3"
run: |
set -euxo pipefail
# See the langsmith-pyo3 README.md file for an explanation
# of why tests have to run under nextest & without default features.
cargo nextest run --no-default-features