normogen/.forgejo/workflows/lint-and-build.yml
goose dae4d680bb
Some checks are pending
Lint and Build / Lint (push) Waiting to run
Lint and Build / Build (push) Blocked by required conditions
Lint and Build / Docker Build (push) Blocked by required conditions
fix(ci): replace GitHub Actions with Forgejo-compatible workflow
The original workflow was using GitHub-specific actions that don't exist
in Forgejo, causing CI to fail immediately with:
  'repository not found: Not Found' for actions-rs/toolchain@v1

Key changes:
- Replace 'runs-on: docker' with 'runs-on: ubuntu-latest' and proper containers
- Remove 'actions-rs/toolchain@v1' (doesn't exist in Forgejo)
  - Use 'rust:latest' container image instead which includes rustfmt, clippy, and cargo
- Update all action references to use full URLs (https://github.com/...)
- Use 'docker:dind' service for Docker-in-Docker support
- Remove 'docker/setup-buildx-action@v3' (not needed for basic docker build)

This workflow is now compatible with Forgejo and should run successfully.
2026-03-11 16:28:46 -03:00

114 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: ubuntu-latest
container:
image: rust:latest
steps:
- name: Checkout code
uses: https://github.com/actions/checkout@v4
- name: Cache cargo registry
uses: https://github.com/actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: https://github.com/actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: https://github.com/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: ubuntu-latest
container:
image: rust:latest
needs: lint
steps:
- name: Checkout code
uses: https://github.com/actions/checkout@v4
- name: Cache cargo registry
uses: https://github.com/actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: https://github.com/actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: https://github.com/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: ubuntu-latest
container:
image: docker:latest
needs: build
services:
docker:
image: docker:dind
steps:
- name: Checkout code
uses: https://github.com/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 .