Skip to content

Add GitHub Actions CI workflow for code validation #2

Description

@rmems

Overview

Add a GitHub Actions CI workflow to automatically validate code quality on every push and pull request.

Workflow file

Create .github/workflows/ci.yml with the following content:

name: CI

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

jobs:
  validate:
    name: Build & Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

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

      - 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 --check

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

      - name: Build
        run: cargo build --all-features

      - name: Test
        run: cargo test --all-features

Checklist

  • Create .github/workflows/ci.yml
  • Ensure Cargo.toml has [workspace] or single-package setup
  • Fix any existing clippy warnings before enabling -D warnings
  • Confirm tests pass locally with cargo test
  • Merge PR ci, license, docs: resolve issues #2, #3, #4 #6 and verify the Actions tab shows a green run on main

Implementation notes

Implemented in PR #6 (issues/#2,#3,#4, commit 71d993d):

  • .github/workflows/ci.yml added (SHA-pinned actions, permissions: contents: read, persist-credentials: false, restore-keys)
  • Invalid .github/workflows/rust.yml stub removed
  • Build & Test and Codacy checks green on latest commit

Labels

ci, dx, good first issue

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions