normogen/.forgejo/workflows/lint-and-build.yml
goose 16434c630c
Some checks failed
Lint, Build, and Docker / format (push) Successful in 32s
Lint, Build, and Docker / clippy (push) Successful in 1m33s
Lint, Build, and Docker / build (push) Successful in 3m32s
Lint, Build, and Docker / docker-build (push) Failing after 13s
fix(ci): revert to DinD service for docker-build
- Socket mount not working with Forgejo runner
- Revert to DinD service with TCP endpoint
- Set DOCKER_HOST=tcp://docker:2375
- Remove socket mount from container config
- This matches the working DinD configuration from commit 3b570e7
2026-03-18 09:02:31 -03:00

141 lines
4.1 KiB
YAML

name: Lint, Build, and Docker
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
# ==============================================================================
# Job 1: Format Check
# ==============================================================================
format:
runs-on: docker
container:
image: rust:latest
steps:
- name: Install Node.js for checkout
run: |
apt-get update
apt-get install -y curl gnupg
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y pkg-config libssl-dev
rustup component add rustfmt
- name: Check formatting
working-directory: ./backend
run: cargo fmt --all -- --check
# ==============================================================================
# Job 2: Lint
# ==============================================================================
clippy:
runs-on: docker
container:
image: rust:latest
steps:
- name: Install Node.js for checkout
run: |
apt-get update
apt-get install -y curl gnupg
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y pkg-config libssl-dev
rustup component add clippy
- name: Run Clippy
working-directory: ./backend
run: cargo clippy --all-targets --all-features
# ==============================================================================
# Job 3: Build - Depends on format and clippy
# ==============================================================================
build:
runs-on: docker
container:
image: rust:latest
needs: [format, clippy]
steps:
- name: Install Node.js for checkout
run: |
apt-get update
apt-get install -y curl gnupg
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y pkg-config libssl-dev
- name: Build release binary
working-directory: ./backend
run: cargo build --release --verbose
# ==============================================================================
# Job 4: Docker Build - Using DinD
# ==============================================================================
docker-build:
runs-on: docker
container:
image: docker:cli
needs: [build]
services:
docker:
image: docker:dind
command: ["dockerd", "--host=tcp://0.0.0.0:2375", "--tls=false"]
options: >-
--privileged
-e DOCKER_TLS_CERTDIR=
steps:
- name: Install Node.js for checkout
run: apk add --no-cache nodejs npm
- name: Checkout code
uses: actions/checkout@v4
- name: Set DOCKER_HOST environment
run: echo "DOCKER_HOST=tcp://docker:2375" >> $GITHUB_ENV
- name: Verify Docker is available
run: |
docker version
docker info
- name: Build Docker image
working-directory: ./backend
run: |
docker build -f docker/Dockerfile -t normogen-backend:${{ github.sha }} -t normogen-backend:latest .
- name: Test Docker image
run: |
docker run --rm normogen-backend:${{ github.sha }} ls -la /app/normogen-backend || echo "Binary check"
- name: Show image info
run: |
docker images normogen-backend
docker inspect normogen-backend:${{ github.sha }} || echo "Image inspect"