-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (76 loc) · 2.4 KB
/
rust-ci.yml
File metadata and controls
92 lines (76 loc) · 2.4 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
name: Rust CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
# Default placeholder values for Ditto environment variables
# These will be overridden by repository secrets in the build-and-test job
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.86
components: rustfmt, clippy
override: true
- name: Check formatting
working-directory: ./rust
run: cargo fmt --all -- --check
- name: Lint
working-directory: ./rust
run: cargo clippy --profile ci --all-targets --all-features -- -D warnings
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.86
components: rustfmt, clippy
override: true
- name: Cache cargo registry and target directory
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Build and Test
working-directory: ./rust
env:
# Ditto environment variables from secrets
DITTO_APP_ID: ${{ secrets.DITTO_APP_ID }}
DITTO_PLAYGROUND_TOKEN: ${{ secrets.DITTO_PLAYGROUND_TOKEN }}
# Build profile settings
CARGO_PROFILE_CI_LTO: "thin"
CARGO_PROFILE_CI_CODEGEN_UNITS: "1"
CARGO_PROFILE_CI_DEBUG: "false"
CARGO_PROFILE_CI_OPT_LEVEL: "3"
CARGO_PROFILE_CI_OVERFLOW_CHECKS: "true"
run: |
# Verify environment variables are set
echo "DITTO_APP_ID: $DITTO_APP_ID"
echo "DITTO_PLAYGROUND_TOKEN: ${DITTO_PLAYGROUND_TOKEN:0:4}..."
# Build with the CI profile
cargo build --profile ci
# Run tests with nextest
cargo nextest run --workspace --all-features --test-threads=1
- name: Run Benchmarks
working-directory: ./rust
run: cargo bench --profile ci || true