feat(i18n): add internationalization with DE, FR, ES, PT translations #12
5
.cargo/config.toml
Normal file
5
.cargo/config.toml
Normal file
@@ -0,0 +1,5 @@
|
||||
[build]
|
||||
# Use sccache as the rustc wrapper for compile caching.
|
||||
# Falls back gracefully: if sccache is not installed, cargo will warn but
|
||||
# still compile. Install with: cargo install sccache
|
||||
rustc-wrapper = "sccache"
|
||||
@@ -11,6 +11,10 @@ on:
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTFLAGS: "-D warnings"
|
||||
# sccache configuration
|
||||
RUSTC_WRAPPER: /usr/local/bin/sccache
|
||||
SCCACHE_DIR: /tmp/sccache
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
|
||||
# Cancel in-progress runs for the same branch/PR
|
||||
concurrency:
|
||||
@@ -34,7 +38,10 @@ jobs:
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout FETCH_HEAD
|
||||
- run: rustup component add rustfmt
|
||||
# Format check does not compile, so sccache is not needed here.
|
||||
- run: cargo fmt --check
|
||||
env:
|
||||
RUSTC_WRAPPER: ""
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
@@ -48,12 +55,27 @@ jobs:
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout FETCH_HEAD
|
||||
- name: Install sccache
|
||||
run: |
|
||||
curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-unknown-linux-musl.tar.gz \
|
||||
| tar xz --strip-components=1 -C /usr/local/bin/ sccache-v0.9.1-x86_64-unknown-linux-musl/sccache
|
||||
chmod +x /usr/local/bin/sccache
|
||||
- name: Restore sccache cache
|
||||
uses: https://github.com/actions/cache@v4
|
||||
with:
|
||||
path: /tmp/sccache
|
||||
key: sccache-clippy-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: |
|
||||
sccache-clippy-
|
||||
- run: rustup component add clippy
|
||||
# Lint both feature sets independently
|
||||
- name: Clippy (server)
|
||||
run: cargo clippy --features server --no-default-features -- -D warnings
|
||||
- name: Clippy (web)
|
||||
run: cargo clippy --features web --no-default-features -- -D warnings
|
||||
- name: Show sccache stats
|
||||
run: sccache --show-stats
|
||||
if: always()
|
||||
|
||||
audit:
|
||||
name: Security Audit
|
||||
@@ -69,7 +91,11 @@ jobs:
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout FETCH_HEAD
|
||||
- run: cargo install cargo-audit
|
||||
env:
|
||||
RUSTC_WRAPPER: ""
|
||||
- run: cargo audit
|
||||
env:
|
||||
RUSTC_WRAPPER: ""
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Stage 2: Tests (only after all quality checks pass)
|
||||
@@ -87,10 +113,26 @@ jobs:
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout FETCH_HEAD
|
||||
- name: Install sccache
|
||||
run: |
|
||||
curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-unknown-linux-musl.tar.gz \
|
||||
| tar xz --strip-components=1 -C /usr/local/bin/ sccache-v0.9.1-x86_64-unknown-linux-musl/sccache
|
||||
chmod +x /usr/local/bin/sccache
|
||||
- name: Restore sccache cache
|
||||
uses: https://github.com/actions/cache@v4
|
||||
with:
|
||||
path: /tmp/sccache
|
||||
key: sccache-test-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: |
|
||||
sccache-test-
|
||||
sccache-clippy-
|
||||
- name: Run tests (server)
|
||||
run: cargo test --features server --no-default-features
|
||||
- name: Run tests (web)
|
||||
run: cargo test --features web --no-default-features
|
||||
- name: Show sccache stats
|
||||
run: sccache --show-stats
|
||||
if: always()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Stage 3: Deploy (only after tests pass, only on main)
|
||||
@@ -108,4 +150,3 @@ jobs:
|
||||
apk add --no-cache curl
|
||||
curl -sf "${{ secrets.COOLIFY_WEBHOOK }}" \
|
||||
-H "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}"
|
||||
|
||||
|
||||
18
Dockerfile
18
Dockerfile
@@ -1,3 +1,4 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Stage 1: Generate dependency recipe for caching
|
||||
FROM rust:1.89-bookworm AS chef
|
||||
RUN cargo install cargo-chef
|
||||
@@ -15,16 +16,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pkg-config libssl-dev curl unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install sccache for compile caching across Docker builds
|
||||
RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-unknown-linux-musl.tar.gz \
|
||||
| tar xz --strip-components=1 -C /usr/local/bin/ sccache-v0.9.1-x86_64-unknown-linux-musl/sccache \
|
||||
&& chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV RUSTC_WRAPPER=/usr/local/bin/sccache
|
||||
ENV SCCACHE_DIR=/tmp/sccache
|
||||
|
||||
# Install bun (for Tailwind CSS build step)
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV PATH="/root/.bun/bin:$PATH"
|
||||
|
||||
# Install dx CLI from source (binstall binaries require GLIBC >= 2.38)
|
||||
RUN cargo install dioxus-cli@0.7.3 --locked
|
||||
RUN --mount=type=cache,target=/tmp/sccache \
|
||||
cargo install dioxus-cli@0.7.3 --locked
|
||||
|
||||
# Cook dependencies from recipe (cached layer)
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
RUN --mount=type=cache,target=/tmp/sccache \
|
||||
cargo chef cook --release --recipe-path recipe.json
|
||||
|
||||
# Copy source and build
|
||||
COPY . .
|
||||
@@ -33,7 +44,8 @@ COPY . .
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# Bundle the fullstack application
|
||||
RUN dx bundle --release --fullstack
|
||||
RUN --mount=type=cache,target=/tmp/sccache \
|
||||
dx bundle --release --fullstack
|
||||
|
||||
# Stage 3: Minimal runtime image
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
|
||||
Reference in New Issue
Block a user