After extensive testing, confirmed that Docker builds are not possible in Forgejo CI due to network isolation: Tested approaches: ❌ Socket mount (/var/run/docker.sock) ❌ DinD service with TCP ❌ Buildx with various configs ❌ Direct host Docker access ❌ runs-on:docker without container Root cause: Forgejo act runner creates isolated networks for each job. No way to access Docker daemon from within these networks. Solution: Handle Docker builds separately via deployment scripts. This is a pragmatic solution that works within Forgejo's infrastructure. CI focuses on what it can do well: code quality checks.
113 lines
3.5 KiB
YAML
113 lines
3.5 KiB
YAML
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.
|
|
# ==============================================================================
|