normogen/.forgejo/workflows/lint-and-build.yml
goose 7b50dc262a
Some checks failed
Lint, Build, and Docker / format (push) Successful in 30s
Lint, Build, and Docker / clippy (push) Successful in 1m29s
Lint, Build, and Docker / build (push) Successful in 3m31s
Lint, Build, and Docker / docker-build (push) Failing after 11s
fix(ci): use working DinD configuration from commit 3b570e7
- Service name: docker-in-docker (not 'docker')
- DOCKER_HOST: tcp://docker-in-docker:2375
- Set environment variables at job level
- This matches the previously working DinD setup
- Remove unnecessary env setting step
2026-03-18 09:09:45 -03:00

139 lines
4 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 (working config)
# ==============================================================================
docker-build:
runs-on: docker
container:
image: docker:cli
needs: [build]
services:
docker-in-docker:
image: docker:dind
env:
DOCKER_TLS_CERTDIR: ""
env:
DOCKER_HOST: tcp://docker-in-docker:2375
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
steps:
- name: Install Node.js for checkout
run: apk add --no-cache nodejs npm
- name: Checkout code
uses: actions/checkout@v4
- 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"