Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: PR Checks

on:
pull_request:

jobs:
validate-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.88.0"
components: rustfmt, clippy

- name: Rust cache
uses: Swatinem/rust-cache@v2

- name: Format check
run: cargo fmt --all --check

- name: Lint
run: cargo clippy --workspace --all-targets

- name: Tests
run: cargo test --workspace --all-targets --locked

docker-build-verify:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Verify multi-arch Docker build
uses: docker/build-push-action@v6
with:
context: .
file: hulykvs_server/Dockerfile
push: false
platforms: linux/amd64,linux/arm64
2 changes: 1 addition & 1 deletion hulykvs_server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM rust:1.86 AS builder
FROM --platform=$BUILDPLATFORM rust:1.88 AS builder
ARG TARGETPLATFORM

WORKDIR /tmp/build
Expand All @@ -24,7 +24,7 @@
cargo build --release --target=aarch64-unknown-linux-gnu ; \
else \
echo "Unexpected target platform: $TARGETPLATFORM" && exit 1 ; \
fi

Check warning on line 27 in hulykvs_server/Dockerfile

View workflow job for this annotation

GitHub Actions / docker-build-verify

Empty continuation lines will become errors in a future release

NoEmptyContinuation: Empty continuation line More info: https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/

FROM debian:12-slim

Expand Down
20 changes: 12 additions & 8 deletions hulykvs_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,18 @@ async fn main() -> anyhow::Result<()> {
info!(?backend, "detected database backend");

let report = match backend {
DbBackend::Cockroach => migrations_crdb::migrations::runner()
.set_migration_table_name("migrations")
.run_async(&mut connection)
.await?,
DbBackend::Postgres => migrations_pg::migrations::runner()
.set_migration_table_name("migrations_pg")
.run_async(&mut connection)
.await?,
DbBackend::Cockroach => {
migrations_crdb::migrations::runner()
.set_migration_table_name("migrations")
.run_async(&mut connection)
.await?
}
DbBackend::Postgres => {
migrations_pg::migrations::runner()
.set_migration_table_name("migrations_pg")
.run_async(&mut connection)
.await?
}
};

for m in report.applied_migrations().iter() {
Expand Down