-
Notifications
You must be signed in to change notification settings - Fork 51
144 lines (120 loc) · 4.08 KB
/
ci.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
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
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
name: CI
env:
CARGO_TERM_COLOR: "always"
RUSTFLAGS: "-D warnings"
PROPTEST_CASES: 10000
MIRIFLAGS: "-Zmiri-strict-provenance"
RUST_VERSION: 1.83.0
RUST_NIGHTLY_VERSION: "nightly-2024-12-20"
jobs:
check:
name: cargo check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: rustup toolchain install ${{ env.RUST_VERSION }} --no-self-update --profile minimal
- uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check --tests --all-features
test:
strategy:
fail-fast: false
matrix:
include:
- toolchain: "1.83.0"
- toolchain: "nightly-2024-12-20"
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: |
rustup toolchain install ${{ matrix.toolchain }} --no-self-update --profile minimal
rustup override set ${{ matrix.toolchain }}
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: cargo test
run: |
cargo nextest run --release --all-features --manifest-path=compact_str/Cargo.toml --run-ignored=all
cargo test --doc --release --all-features --manifest-path=compact_str/Cargo.toml
miri:
name: cargo miri test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_VERSION }} --no-self-update --profile minimal --component miri
rustup override set ${{ env.RUST_NIGHTLY_VERSION }}
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Run Miri
run: |
cargo miri nextest run --all-features --manifest-path=compact_str/Cargo.toml
cargo miri test --doc --all-features --manifest-path=compact_str/Cargo.toml
randomize-layout:
name: cargo test -Zrandomize-layout
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Zrandomize-layout
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_VERSION }} --no-self-update --profile minimal
rustup override set ${{ env.RUST_NIGHTLY_VERSION }}
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Run Tests with Randomized Layout
run: |
cargo nextest run --all-features --manifest-path=compact_str/Cargo.toml
cargo test --doc --all-features --manifest-path=compact_str/Cargo.toml
examples:
name: example - ${{ matrix.ex }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ex: ["bytes", "macros", "serde", "traits"]
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: |
rustup toolchain install ${{ env.RUST_VERSION }} --no-self-update --profile minimal
rustup override set ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.ex }}
- name: Run example-${{ matrix.ex }}
run: cargo run --manifest-path examples/${{ matrix.ex }}/Cargo.toml
example-tests:
name: example - ${{ matrix.ex }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ex: ["diesel", "sqlx"]
steps:
- uses: actions/checkout@v4
- name: Install toolchain
run: |
rustup toolchain install ${{ env.RUST_VERSION }} --no-self-update --profile minimal
rustup override set ${{ env.RUST_VERSION }}
- name: Install Third Party Libraries
run: |
sudo apt-get install sqlite3 libsqlite3-dev
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.ex }}-test
- name: Test example-${{ matrix.ex }}
run: cargo test --manifest-path examples/${{ matrix.ex }}/Cargo.toml