-
Notifications
You must be signed in to change notification settings - Fork 59
242 lines (194 loc) · 5.72 KB
/
checks.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
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
name: checks
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [published]
merge_group:
workflow_dispatch:
inputs:
crate:
description: Which crate to publish
required: true
type: choice
options:
- neo4rs
- neo4rs-macros
env:
RUST_LOG: debug
CARGO_TERM_COLOR: always
MSRV: 1.75.0
HACK: hack --package neo4rs --each-feature --exclude-features unstable-serde-packstream-format,unstable-bolt-protocol-impl-v2,unstable-result-summary
jobs:
check:
name: Compile on MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Prepare MSRV lockfile
run: cp ci/Cargo.lock.msrv Cargo.lock
- name: Run cargo check
run: cargo +$MSRV --locked ${{ env.HACK }} check
fmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
run: cargo +stable fmt --all -- --check
clippy:
name: Check clippy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
components: clippy
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Prepare MSRV lockfile
run: cp ci/Cargo.lock.msrv Cargo.lock
- name: Run clippy
run: cargo +$MSRV --locked ${{ env.HACK }} clippy -- -D warnings
unit-tests:
name: Run unit tests
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run unit tests
run: cargo ${{ env.HACK }} nextest run --lib
integration-tests:
name: Run integration tests
strategy:
fail-fast: false
matrix:
neo4j: ["5", "4.4"]
runs-on: ubuntu-latest
services:
neo4j:
image: neo4j:${{ matrix.neo4j }}-enterprise
env:
NEO4J_ACCEPT_LICENSE_AGREEMENT: yes
NEO4J_AUTH: neo4j/integrationtest
ports:
- "7687:7687"
env:
NEO4J_TEST_URI: bolt://localhost:7687
NEO4J_TEST_USER: neo4j
NEO4J_TEST_PASS: integrationtest
NEO4J_VERSION_TAG: ${{ matrix.neo4j }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Prepare MSRV lockfile
run: cp ci/Cargo.lock.msrv Cargo.lock
- name: Run integration tests
run: cargo +$MSRV --locked ${{ env.HACK }} nextest run -E 'kind(test)'
msrv:
name: Validate MSRV and minimal dependency versions
strategy:
fail-fast: false
matrix:
include:
- file: Cargo.lock.msrv
name: MSRV
- file: Cargo.lock.min
name: minimal dependency versions
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- name: Prepare ${{ matrix.name }} lockfile
run: cp ci/${{ matrix.file }} Cargo.lock
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run ${{ matrix.name }} unit tests
run: cargo +$MSRV nextest run --lib --all-features --locked
release:
name: Release
needs: [check, fmt, clippy, unit-tests, integration-tests, msrv]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
if: startsWith(github.ref, 'refs/tags/')
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Set up Rust cache
if: startsWith(github.ref, 'refs/tags/')
uses: Swatinem/rust-cache@v2
- name: Publish release
if: startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p ${{ inputs.crate || 'neo4rs' }}