Skip to content

[TASK] Implement Automated Testing in CI/CD Pipeline #55

@ElioNeto

Description

@ElioNeto

🎯 Task Overview

Set up automated testing in GitHub Actions to run cargo test --all-features on every pull request and push to main branches.

📝 Description

Currently, tests need to be run manually. We need automated CI/CD to:

  • Catch regressions early
  • Ensure code quality before merging
  • Validate all features work together
  • Run on multiple Rust versions

🛠️ Implementation Plan

1. Create GitHub Actions Workflow

File: .github/workflows/test.yml

name: Tests

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

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test Suite
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust: [stable, beta, nightly]
    steps:
      - uses: actions/checkout@v4
      
      - name: Install Rust
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      
      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: ~/.cargo/registry
          key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
      
      - name: Cache cargo index
        uses: actions/cache@v4
        with:
          path: ~/.cargo/git
          key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
      
      - name: Cache target directory
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
      
      - name: Run tests (all features)
        run: cargo test --all-features --verbose
      
      - name: Run doctests
        run: cargo test --doc --all-features

  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - run: cargo fmt --all -- --check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - run: cargo clippy --all-features -- -D warnings

2. Add Status Badges to README

[![Tests](https://github.com/ElioNeto/ApexStore/workflows/Tests/badge.svg)](https://github.com/ElioNeto/ApexStore/actions)
[![Clippy](https://github.com/ElioNeto/ApexStore/workflows/Clippy/badge.svg)](https://github.com/ElioNeto/ApexStore/actions)

3. Branch Protection Rules

Enable on main and develop branches:

  • Require PR reviews before merging
  • Require status checks to pass (Tests, Clippy)
  • Require branches to be up to date

✅ Acceptance Criteria

  • GitHub Actions workflow created
  • Tests run on push to main/develop
  • Tests run on all PRs
  • Multiple Rust versions tested (stable, beta, nightly)
  • Clippy checks enabled
  • Rustfmt checks enabled
  • Status badges in README
  • Branch protection enabled

📊 Expected Benefits

  • Automated regression detection
  • Consistent code formatting
  • Early warning of breaking changes
  • Confidence in PR merges
  • Professional project presentation

Labels: task, ci/cd, testing, priority:high
Priority: High
Milestone: v2.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions