feat: add admin/profile UI, i18n (fr/de/pt), fix CI pipelines

- Add admin panel link and profile modal in user menu dropdown
- Add French, German and Portuguese locale support (full translations)
- Register new locales across JS frontend and Rust backend
- Create CI pipeline (fmt, clippy, test, audit, build)
- Fix docker-build.yml (cache, real tests, reduced timeout)
- Fix docker-publish.yml (multi-arch via QEMU, latest tag, pre-publish tests)
- Add dependabot.yml for automated dependency updates
This commit is contained in:
Dionisio
2026-02-11 12:26:29 +01:00
parent 6b55cdf3c4
commit 3050955f9c
21 changed files with 1422 additions and 408 deletions
+85
View File
@@ -0,0 +1,85 @@
name: CI
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
DATABASE_URL: "postgres://postgres:postgres@localhost/oxicloud_test"
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features -- -D warnings
test:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: oxicloud_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Initialize test database
run: psql -h localhost -U postgres -d oxicloud_test -f db/schema.sql
env:
PGPASSWORD: postgres
- name: Run tests
run: cargo test --all-features --workspace
env:
DATABASE_URL: "postgres://postgres:postgres@localhost/oxicloud_test"
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build Check
runs-on: ubuntu-latest
needs: [fmt, clippy, test]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --release
+34 -14
View File
@@ -1,6 +1,5 @@
name: Docker Build and Test
# Trigger on push to main branch or on pull requests
on:
push:
branches: [ "main", "dev" ]
@@ -8,21 +7,18 @@ on:
branches: [ "main", "dev" ]
jobs:
# Build and test Docker image but don't push
build-and-test:
name: Build and Test Docker Image
runs-on: ubuntu-latest
timeout-minutes: 120 # Aumentado a 2 horas para dar más tiempo a la compilación
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Extract metadata (tags, labels) for Docker
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
@@ -33,7 +29,6 @@ jobs:
type=ref,event=pr
type=sha
# Build Docker image but don't push
- name: Build Docker image
uses: docker/build-push-action@v5
with:
@@ -41,16 +36,41 @@ jobs:
push: false
load: true
tags: test/oxicloud:test
# Caché eliminado para evitar problemas de expiración de token
cache-from: type=gha
cache-to: type=gha,mode=max
# Run some basic tests against the built image
- name: Test Docker image
- name: Verify image starts correctly
run: |
docker run --rm test/oxicloud:test --version || true
docker run --rm test/oxicloud:test --help || true
# Start the container in background
docker run -d --name oxicloud-test \
-e DATABASE_URL="postgres://test:test@localhost/test" \
-p 8080:8080 \
test/oxicloud:test || true
# Verify the image structure
echo "✅ Checking Docker image layers and size"
docker image inspect test/oxicloud:test
# Give it a moment to start (or fail)
sleep 3
# Check that the container exists and show logs
echo "=== Container status ==="
docker ps -a --filter name=oxicloud-test
echo "=== Container logs ==="
docker logs oxicloud-test 2>&1 || true
# Cleanup
docker rm -f oxicloud-test || true
- name: Verify image structure
run: |
echo "=== Image size ==="
docker image ls test/oxicloud:test
echo "=== Binary exists and is executable ==="
docker run --rm --entrypoint sh test/oxicloud:test -c "test -x /usr/local/bin/oxicloud && echo 'OK: binary is executable'"
echo "=== Static files present ==="
docker run --rm --entrypoint sh test/oxicloud:test -c "ls /app/static/index.html && echo 'OK: static files present'"
echo "=== DB schema present ==="
docker run --rm --entrypoint sh test/oxicloud:test -c "ls /app/db/schema.sql && echo 'OK: schema present'"
echo "✅ Docker build and test completed successfully"
+45 -48
View File
@@ -6,63 +6,47 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Versión del release'
required: false
default: '0.1.0-rc1'
description: 'Version tag to publish (e.g. v0.3.0)'
required: true
env:
REGISTRY_IMAGE: diocrafts/oxicloud
jobs:
build-and-push:
# Run tests before publishing
test:
name: Pre-publish Tests
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace
# Build and push multi-arch image in a single job
build-and-push:
name: Build & Push Multi-Arch
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set version tag
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
VERSION="${{ github.event.inputs.version }}"
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
VERSION="${GITHUB_REF#refs/tags/}"
fi
# Strip leading 'v' if present for Docker tag
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/${{ matrix.arch }}
push: true
tags: |
diocrafts/oxicloud:${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ env.VERSION }}
# Crear el manifiesto multi-arch una vez todas las imágenes estén listas
manifest:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Set version tag
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -73,9 +57,22 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create and Push Manifest
- name: Build and Push Multi-Arch Image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.REGISTRY_IMAGE }}:${{ env.VERSION }}
${{ env.REGISTRY_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ env.VERSION }}
- name: Verify published image
run: |
docker buildx imagetools create \
-t diocrafts/oxicloud:${{ env.VERSION }} \
diocrafts/oxicloud:${{ env.VERSION }}@linux/amd64 \
diocrafts/oxicloud:${{ env.VERSION }}@linux/arm64
docker pull ${{ env.REGISTRY_IMAGE }}:${{ env.VERSION }}
docker image inspect ${{ env.REGISTRY_IMAGE }}:${{ env.VERSION }}
echo "✅ Image ${{ env.REGISTRY_IMAGE }}:${{ env.VERSION }} published successfully"