Skip to content

Commit 6a2883f

Browse files
Merge pull request #6 from hcengineering/upgrade-rust
Update rust version and add CI verification
2 parents 62cc4ef + 213f353 commit 6a2883f

3 files changed

Lines changed: 64 additions & 9 deletions

File tree

.github/workflows/pr-checks.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: PR Checks
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
validate-and-test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Rust
15+
uses: dtolnay/rust-toolchain@stable
16+
with:
17+
toolchain: "1.88.0"
18+
components: rustfmt, clippy
19+
20+
- name: Rust cache
21+
uses: Swatinem/rust-cache@v2
22+
23+
- name: Format check
24+
run: cargo fmt --all --check
25+
26+
- name: Lint
27+
run: cargo clippy --workspace --all-targets
28+
29+
- name: Tests
30+
run: cargo test --workspace --all-targets --locked
31+
32+
docker-build-verify:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Verify multi-arch Docker build
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: .
49+
file: hulykvs_server/Dockerfile
50+
push: false
51+
platforms: linux/amd64,linux/arm64

hulykvs_server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM rust:1.86 AS builder
1+
FROM --platform=$BUILDPLATFORM rust:1.88 AS builder
22
ARG TARGETPLATFORM
33

44
WORKDIR /tmp/build

hulykvs_server/src/main.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,18 @@ async fn main() -> anyhow::Result<()> {
147147
info!(?backend, "detected database backend");
148148

149149
let report = match backend {
150-
DbBackend::Cockroach => migrations_crdb::migrations::runner()
151-
.set_migration_table_name("migrations")
152-
.run_async(&mut connection)
153-
.await?,
154-
DbBackend::Postgres => migrations_pg::migrations::runner()
155-
.set_migration_table_name("migrations_pg")
156-
.run_async(&mut connection)
157-
.await?,
150+
DbBackend::Cockroach => {
151+
migrations_crdb::migrations::runner()
152+
.set_migration_table_name("migrations")
153+
.run_async(&mut connection)
154+
.await?
155+
}
156+
DbBackend::Postgres => {
157+
migrations_pg::migrations::runner()
158+
.set_migration_table_name("migrations_pg")
159+
.run_async(&mut connection)
160+
.await?
161+
}
158162
};
159163

160164
for m in report.applied_migrations().iter() {

0 commit comments

Comments
 (0)