Repository navigation
193 lines (174 loc) · 6 KB
/
Copy pathrust.yaml
File metadata and controls
193 lines (174 loc) · 6 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
name: Rust
on:
# Filter the whole workflow so unrelated changes don't create skipped
# matrix jobs. Keep both events' paths in sync.
push:
branches:
- master
paths:
- ".github/workflows/rust.yaml"
- "Makefile"
- "conformance/**"
- "internal/cmd/syncrustmigrations/**"
- "riverdriver/riverpgxv5/migration/**"
- "riverdriver/riversqlite/migration/**"
- "rust/**"
pull_request:
paths:
- ".github/workflows/rust.yaml"
- "Makefile"
- "conformance/**"
- "internal/cmd/syncrustmigrations/**"
- "riverdriver/riverpgxv5/migration/**"
- "riverdriver/riversqlite/migration/**"
- "rust/**"
permissions:
contents: read
env:
# Cache reusable dependencies instead of incremental workspace builds.
CARGO_INCREMENTAL: "0"
jobs:
quality:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt
# Prune workspace binaries, docs, and unused dependencies before saving.
# PRs restore master caches without saving duplicate branch snapshots.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target
- uses: taiki-e/install-action@v2
with:
tool: cargo-deny@0.20.2
- name: Lint, including Postgres-only and SQLite-only builds
run: make lint/rust
- name: Documentation and examples
run: make doc/rust
- name: Dependency and license policy
run: make check/rust/dependencies
docsrs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@nightly
# Key the nightly build cache with the compiler that actually builds it.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target/docsrs
- name: Documentation as docs.rs builds it
run: make doc/rust/docsrs
package:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
# Package verification intentionally compiles in a fresh temporary build
# directory; only registry downloads can be reused between runs.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
cache-targets: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target
- name: Package archives
run: make check/rust/package
semver:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target
- uses: taiki-e/install-action@v2
with:
tool: cargo-semver-checks@0.51.0
# Compare with the latest published Rust release tag, which the full
# checkout above includes. Before the first release there is no
# baseline and the step reports that instead of failing.
- name: Public API compatibility
run: make check/rust/semver
rust_versions:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
rust-version: ["1.95", "1.96", "1.97"]
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target
# Tests read fixtures generated from River's Go implementation.
- uses: actions/setup-go@v7
with:
go-version-file: go.work
- name: Check every target and feature
run: cargo check --manifest-path rust/Cargo.toml --workspace --all-targets --all-features --locked
- name: Unit, doc, and SQLite tests
run: make test/rust/sqlite
postgres:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
postgres-version: [14, 15, 16, 17, 18]
env:
RIVER_RUST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/river_rust_test?sslmode=disable
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 2s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
# The database versions share build artifacts; one matrix job saves them.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.postgres-version == 18 }}
workspaces: rust -> target
# Tests read fixtures generated from River's Go implementation.
- uses: actions/setup-go@v7
with:
go-version-file: go.work
- name: Create test database
run: PGPASSWORD=postgres createdb -h localhost -U postgres river_rust_test
- name: Rust unit, SQLite, and Postgres tests
run: make test/rust