normogen/.forgejo/workflows/lint-and-build.yml
goose 04f19e813f
Some checks failed
Lint and Build / Lint (push) Has been cancelled
Lint and Build / Build (push) Has been cancelled
Lint and Build / Docker Build (push) Has been cancelled
fix(ci): Use Docker-labeled runner for all CI/CD jobs
Updated all jobs in the lint-and-build workflow to use the
Docker-labeled runner instead of ubuntu-latest.

Changes:
- lint job: runs-on: docker
- build job: runs-on: docker
- docker-build job: runs-on: docker

Benefits:
- Native Docker support
- Faster builds
- Better performance on local infrastructure
- Consistent with server setup
2026-02-15 20:41:58 -03:00

123 lines
2.9 KiB
YAML

name: Lint and Build
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
lint:
name: Lint
runs-on: docker
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
override: true
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: backend/target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run rustfmt
working-directory: ./backend
run: |
cargo fmt --all -- --check
- name: Run clippy
working-directory: ./backend
run: |
cargo clippy --all-targets --all-features -- -D warnings
build:
name: Build
runs-on: docker
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: backend/target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build project
working-directory: ./backend
run: |
cargo build --verbose
- name: Run tests
working-directory: ./backend
run: |
cargo test --verbose
docker-build:
name: Docker Build
runs-on: docker
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
working-directory: ./backend
run: |
docker build -f docker/Dockerfile -t normogen-backend:test .
- name: Build Docker image (dev)
working-directory: ./backend
run: |
docker build -f docker/Dockerfile.dev -t normogen-backend:dev-test .