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
162 changes: 0 additions & 162 deletions .github/workflows/automatic-version-sync.yml

This file was deleted.

7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ jobs:
manifest: wrapper/Cargo.toml
target: wrapper/target
lockfile: wrapper/Cargo.lock
- name: sync-versions
manifest: infrastructure/sync_versions/Cargo.toml
target: infrastructure/sync_versions/target
lockfile: infrastructure/sync_versions/Cargo.lock
steps:
- *checkout-code

Expand Down Expand Up @@ -137,7 +133,6 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
infrastructure/sync_versions/target
wrapper/target
key: v1-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
Expand Down Expand Up @@ -171,6 +166,8 @@ jobs:
context: .
load: true
tags: meilisearch-lambda-wrapper-api:test
build-args: |
RUST_VERSION=${{ steps.rust-version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max

Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/update-deps-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update Docker Images
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # Run every Sunday at midnight

jobs:
update-docker:
runs-on: ubuntu-latest
steps:
- name: Create temporary GitHub App Token
id: app
uses: actions/create-github-app-token@v3
with:
owner: ${{ github.repository_owner }}
app-id: ${{ vars.HOUSEKEEPING_BOT_APP_ID }}
private-key: ${{ secrets.HOUSEKEEPING_BOT_PRIVATE_KEY }}

- name: Update Docker Images
uses: alchemaxinc/update-deps/docker@v2
with:
token: ${{ steps.app.outputs.token }}
auto-merge: "true"
base-branch: "main"
branch-prefix: "fix/auto/update-docker-images"
# chore: so semantic-release doesn't create a new release for
# Dockerfile-only changes (which don't affect the wrapper binary)
pr-title: "chore: automatic Docker image upgrades"
commit-message: "chore: update docker images"
markdown-glob: "**/*.md"
# Rust builder image is driven by rust-toolchain.toml via a
# --build-arg in the Dockerfile; the cargo updater bumps it.
excluded-images: "rust"
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Build stage: compile the Rust wrapper binary
FROM rust:1.94-alpine AS builder
# RUST_VERSION is sourced from rust-toolchain.toml so the cargo updater
# (which bumps the channel field) is the single source of truth.
ARG RUST_VERSION=1.95.0
FROM rust:${RUST_VERSION}-alpine AS builder

RUN apk add --no-cache musl-dev

Expand Down
29 changes: 8 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ SERVICE_NAME=meilisearch-lambda-wrapper
DOCKER_IMAGE_NAME=$(SERVICE_NAME)-api
DOCKER_IMAGE_TAG?=abc123def

# Sourced from rust-toolchain.toml so the cargo updater drives the Docker
# builder image version too (see .github/workflows/update-deps-docker.yml,
# which excludes `rust` from the docker-image bumper).
RUST_VERSION := $(shell sed -nE 's/^channel[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/p' rust-toolchain.toml)

# Rust crate manifest paths
WRAPPER_MANIFEST=wrapper/Cargo.toml
SYNC_VERSIONS_MANIFEST=infrastructure/sync_versions/Cargo.toml

STRESS_TEST_SCRIPT=infrastructure/stress_tests/stress-test.js

Expand All @@ -20,6 +24,7 @@ define docker_build
docker buildx build \
--provenance=false \
--platform linux/$(1) \
--build-arg RUST_VERSION=$(RUST_VERSION) \
$(2) \
-t $(3) \
-f Dockerfile .
Expand All @@ -36,57 +41,39 @@ clean: ## Clean up built files

.PHONY: lint
lint: ## Run linter
cargo clippy \
--manifest-path $(SYNC_VERSIONS_MANIFEST) \
--all-targets \
-- -D warnings
cargo clippy \
--manifest-path $(WRAPPER_MANIFEST) \
--all-targets \
-- -D warnings
cargo +nightly fmt \
--manifest-path $(SYNC_VERSIONS_MANIFEST) \
-- --check
cargo +nightly fmt \
--manifest-path $(WRAPPER_MANIFEST) \
-- --check
npx prettier --check .

.PHONY: format
format: ## Format files
cargo clippy \
--manifest-path $(SYNC_VERSIONS_MANIFEST) \
--all-targets \
--fix --allow-dirty
cargo clippy \
--manifest-path $(WRAPPER_MANIFEST) \
--all-targets \
--fix --allow-dirty
cargo +nightly fmt \
--manifest-path $(SYNC_VERSIONS_MANIFEST)
cargo +nightly fmt \
--manifest-path $(WRAPPER_MANIFEST)
npx prettier --write .

.PHONY: build
build: ## Build all Rust crates
cargo build \
--manifest-path $(SYNC_VERSIONS_MANIFEST) \
--release
cargo build \
--manifest-path $(WRAPPER_MANIFEST) \
--release

.PHONY: test-unit
test-unit: ## Run unit tests
cargo test \
--manifest-path $(SYNC_VERSIONS_MANIFEST)
cargo test \
--manifest-path $(WRAPPER_MANIFEST)

.PHONY: test-integration
test-integration: ## Run integration tests
docker build -t $(DOCKER_IMAGE_NAME):test .
docker build --build-arg RUST_VERSION=$(RUST_VERSION) -t $(DOCKER_IMAGE_NAME):test .
docker compose -f $(INTEGRATION_COMPOSE) up -d --wait
MEILI_MASTER_KEY=test-master-key-12345 cargo test \
--manifest-path $(WRAPPER_MANIFEST) \
Expand All @@ -98,7 +85,7 @@ test-integration: ## Run integration tests

.PHONY: test-stress
test-stress: ## Run k6 stress tests (requires k6: https://grafana.com/docs/k6/latest/set-up/install-k6/)
docker build -t $(DOCKER_IMAGE_NAME):test .
docker build --build-arg RUST_VERSION=$(RUST_VERSION) -t $(DOCKER_IMAGE_NAME):test .
docker compose -f $(INTEGRATION_COMPOSE) up -d --wait
k6 run $(STRESS_TEST_SCRIPT); \
exit_code=$$?; \
Expand Down
15 changes: 0 additions & 15 deletions infrastructure/sync_versions/Cargo.toml

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions infrastructure/sync_versions/src/handlers/mod.rs

This file was deleted.

Loading
Loading