name: Lint and Build 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 # ============================================================================== # NOTE: Docker build disabled due to DNS/network issues with DinD services # # The Forgejo runner creates temporary networks for each job, causing # DNS resolution issues when trying to connect to DinD services. # # Docker builds should be done separately: # - Locally: docker build -f backend/docker/Dockerfile -t normogen-backend:latest # - On Solaria: Use deployment scripts in docs/deployment/ # # Future solution: Configure Forgejo runner with Docker-in-Docker properly # or use a container registry with proper BuildKit support. # ==============================================================================