[DevOps] Add Gitea Actions CI Workflow (fmt + clippy + test) #6

Open
opened 2026-06-26 05:05:32 +00:00 by funman300 · 0 comments
Owner

Overview

Add automated CI that runs on every push and PR to keep the codebase clean and all tests green.

Steps

1. Create .gitea/workflows/ci.yml

Gitea Actions uses the same YAML syntax as GitHub Actions:

name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust stable
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Clippy (deny warnings)
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Tests
        run: cargo test --all

  msrv:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.78
      - run: cargo test --all

2. Pin MSRV in Cargo.toml

[package]
rust-version = "1.78"

Choose the oldest Rust version you intend to support; 1.78 is a reasonable baseline for tokio 1.x + axum 0.7.

3. Verify the Gitea Actions runner is registered

Check that the self-hosted runner for git.aleshym.co is online and labelled ubuntu-latest. If not, follow the Gitea Actions runner docs to register one on the homelab. The runner needs cargo/rustup available or access to the Docker image that provides them.

4. Add a CI status badge to README.md

[![CI](https://git.aleshym.co/funman300/OpenFUT-Core/actions/workflows/ci.yml/badge.svg)](https://git.aleshym.co/funman300/OpenFUT-Core/actions/workflows/ci.yml)

5. Fix any pre-existing fmt/clippy warnings

Before merging, run cargo fmt --all and cargo clippy --all-targets -- -D warnings locally and resolve all warnings so CI starts green.

Acceptance Criteria

  • .gitea/workflows/ci.yml exists and is syntactically valid
  • CI pipeline runs on push to main and on PRs
  • All three steps pass on the current main branch: fmt, clippy, tests
  • MSRV pinned to 1.78 in Cargo.toml
  • MSRV job passes on Rust 1.78
  • README.md has the CI badge
## Overview Add automated CI that runs on every push and PR to keep the codebase clean and all tests green. ## Steps ### 1. Create `.gitea/workflows/ci.yml` Gitea Actions uses the same YAML syntax as GitHub Actions: ```yaml name: CI on: push: branches: [main] pull_request: branches: [main] env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 jobs: build-and-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Rust stable uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - name: Cache cargo registry uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Check formatting run: cargo fmt --all -- --check - name: Clippy (deny warnings) run: cargo clippy --all-targets --all-features -- -D warnings - name: Tests run: cargo test --all msrv: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.78 - run: cargo test --all ``` ### 2. Pin MSRV in `Cargo.toml` ```toml [package] rust-version = "1.78" ``` Choose the oldest Rust version you intend to support; 1.78 is a reasonable baseline for `tokio` 1.x + `axum` 0.7. ### 3. Verify the Gitea Actions runner is registered Check that the self-hosted runner for `git.aleshym.co` is online and labelled `ubuntu-latest`. If not, follow the [Gitea Actions runner docs](https://gitea.com/gitea/act_runner) to register one on the homelab. The runner needs `cargo`/`rustup` available or access to the Docker image that provides them. ### 4. Add a CI status badge to `README.md` ```markdown [![CI](https://git.aleshym.co/funman300/OpenFUT-Core/actions/workflows/ci.yml/badge.svg)](https://git.aleshym.co/funman300/OpenFUT-Core/actions/workflows/ci.yml) ``` ### 5. Fix any pre-existing fmt/clippy warnings Before merging, run `cargo fmt --all` and `cargo clippy --all-targets -- -D warnings` locally and resolve all warnings so CI starts green. ## Acceptance Criteria - [ ] `.gitea/workflows/ci.yml` exists and is syntactically valid - [ ] CI pipeline runs on push to `main` and on PRs - [ ] All three steps pass on the current `main` branch: fmt, clippy, tests - [ ] MSRV pinned to 1.78 in `Cargo.toml` - [ ] MSRV job passes on Rust 1.78 - [ ] `README.md` has the CI badge
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/OpenFUT-Core#6