normogen/.forgejo/workflows/lint-and-build.yml
goose e2747bc603
Some checks failed
Lint and Build / Lint (push) Failing after 30s
Lint and Build / Build (push) Has been skipped
Lint and Build / Docker Build (push) Has been skipped
fix(ci): install rustfmt and clippy components
The CI was failing because rustfmt is not installed by default in
the rust:latest Docker image.

Error: 'cargo-fmt' is not installed for the toolchain '1.94.0'

Solution:
- Add 'rustup component add rustfmt clippy' step
- This installs both rustfmt and clippy before running lint checks

This allows the fmt and clippy checks to run successfully.
2026-03-12 08:49:08 -03:00

106 lines
2.4 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
container:
image: rust:latest
steps:
- name: Install Node.js
run: |
apt-get update && apt-get install -y curl
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust components
run: |
rustup component add rustfmt clippy
- name: Install dependencies
run: |
apt-get update && apt-get install -y pkg-config libssl-dev
- 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
container:
image: rust:latest
needs: lint
steps:
- name: Install Node.js
run: |
apt-get update && apt-get install -y curl
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update && apt-get install -y pkg-config libssl-dev
- name: Build project
working-directory: ./backend
run: |
cargo build --release --verbose
- name: Run tests
working-directory: ./backend
run: |
cargo test --verbose
docker-build:
name: Docker Build
runs-on: docker
container:
image: docker:latest
needs: build
services:
docker:
image: docker:dind
steps:
- name: Install Node.js
run: |
apk add --no-cache nodejs npm
- name: Checkout repository
uses: actions/checkout@v4
- 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 .