Repository navigation
166 lines (150 loc) · 5.48 KB
/
Copy pathrust.yaml
File metadata and controls
166 lines (150 loc) · 5.48 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
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:
# Keep the cross-run cache small; Cargo still reuses compiled dependencies.
CARGO_INCREMENTAL: "0"
jobs:
quality:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
id: rust
with:
components: clippy,rustfmt
- name: Cache Rust dependencies and build artifacts
uses: actions/cache@v6
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
rust/target
key: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('rust/**/Cargo.toml', 'rust/Cargo.lock') }}
restore-keys: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-
- uses: taiki-e/install-action@v2
with:
tool: cargo-deny@0.20.2
- uses: taiki-e/install-action@v2
with:
tool: cargo-semver-checks@0.51.0
- 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
- name: Package archives
run: make check/rust/package
# 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
# docs.rs builds with a nightly toolchain and `--cfg docsrs`, which
# enables the crates' `doc_cfg` feature badges. Last, since installing
# nightly makes it the default toolchain for later steps.
- uses: dtolnay/rust-toolchain@nightly
- name: Documentation as docs.rs builds it
run: make doc/rust/docsrs
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
id: rust
with:
toolchain: ${{ matrix.rust-version }}
- name: Cache Rust dependencies and build artifacts
uses: actions/cache@v6
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
rust/target
key: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('rust/**/Cargo.toml', 'rust/Cargo.lock') }}
restore-keys: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-
# 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
id: rust
- name: Cache Rust dependencies and build artifacts
uses: actions/cache@v6
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
rust/target
key: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('rust/**/Cargo.toml', 'rust/Cargo.lock') }}
restore-keys: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-
# 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