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 builds are handled separately due to Forgejo runner limitations # # The Forgejo act runner creates isolated networks for each job, making it # impossible to access Docker from within CI jobs. All attempts to work around # this have failed: # - Socket mount: Socket not accessible in container # - DinD service: DNS resolution fails across networks # - Buildx: Same network isolation issues # - Direct host access: Network isolation prevents this # # Docker builds are done separately: # - Locally: docker build -f backend/docker/Dockerfile # - On Solaria: docs/deployment/deploy-to-solaria.sh # # This is a pragmatic solution that works within Forgejo's infrastructure. # ==============================================================================