68 releases (42 stable)

24.0.0-alpha.1 Oct 29, 2024
23.0.0 Oct 16, 2024
22.0.1 Aug 31, 2024
21.1.1 Aug 30, 2024
0.0.4 Feb 15, 2023

#57 in Testing

Download history 182/week @ 2024-08-19 741/week @ 2024-08-26 32/week @ 2024-09-02 8/week @ 2024-09-09 8/week @ 2024-09-16 157/week @ 2024-09-23 4/week @ 2024-09-30 269/week @ 2024-10-14 8/week @ 2024-10-21 106/week @ 2024-10-28 69/week @ 2024-11-04 15/week @ 2024-11-18 87/week @ 2024-12-02

104 downloads per month

AGPL-3.0

120KB
2.5K SLoC

zuu

Zuu Project

Zuu is a continuous verification tool for multiple programming languages.

It allows you to run tests, check code formatting, perform security audits, and more, based on the configured programming language.

Table of Contents

Features

  • Multi-language support:
    • Clojure
    • Cobol
    • Erlang
    • Fortran
    • Groovy
    • Julia
    • Matlab
    • Vlang
  • Customizable testing options using environment variables for test control.
  • Isolation of development and test environments via Docker and Docker Compose.
  • Flexible configuration using Cargo features.
  • Execute tests, format checks, security audits, and more for each supported language.

Requirements

Installation

  1. Clone the repository to your machine:

    git clone https://github.com/otechdo/zuu.git
    cd zuu
    
  2. Running with Docker Compose

To run the project in an isolated Docker environment, use Docker Compose.

You can run tests for each supported language.

To start a test container for a specific language, use the following command:

docker-compose up --build --abort-on-container-exit <service-name>

For example, to run the tests for Rust:

docker-compose up --build --abort-on-container-exit rust-tests
  1. Running Tests for All Languages

You can also run all the tests sequentially for every supported language:

docker-compose up --build --abort-on-container-exit
  1. Using Cargo

If you're working locally with Rust and want to compile the project with a specific language feature, use Cargo features. For example, to activate the feature for Rust:

cargo build --no-default-features --features "rust"

Zuu Configuration Options

Zuu provides several options that you can control via environment variables to customize the checks it performs. The configuration options allow you to enable or disable specific tasks such as testing, linting, formatting checks, security audits, and license validation.

Available Options

Environment Variable Description Default
TESTS Enable or disable the execution of tests. false
FORMAT Check if the code is properly formatted. false
LINT Run a linting process to catch potential issues. false
AUDIT Perform a security audit of the dependencies. false
LICENSE Check the license compatibility of dependencies. false

Usage

These options are controlled using environment variables, which you can set when running the project in either your development or Docker environment. By default, all options are disabled (false), but you can enable them as needed by setting them to true.

Running Locally:

When running locally, you can set these environment variables in your shell before executing the Zuu tool:

export TESTS=true       # Enable test execution
export FORMAT=true      # Enable code formatting checks
export LINT=true        # Enable linting
export AUDIT=true       # Enable security audit
export LICENSE=true     # Enable license checks

# Run the tool after setting the environment variables
cargo run

Using Docker Compose

In the docker-compose.yml file, you can define these options under the environment section for your service. For example:

services:
  zuu:
    image: otechdo/zuu:latest
    environment:
      - TESTS=true
      - FORMAT=true
      - LINT=true
      - AUDIT=true
      - LICENSE=true
      - EDITOR=vim
    volumes:
      - .:/app # Copy source code in the container
    command:
      - rust-audit # Check rust code

This will run Zuu with all the options enabled.

Customizing Options in Docker

You can adjust these options in Docker by modifying the environment variables in your docker-compose.yml or when running the Docker container.

For example:

docker run -e TESTS=true -e FORMAT=true -e LINT=false -e AUDIT=true -e LICENSE=true your-docker-image

Customisation

Follow these steps to customise the project, edit the Dockerfiles, and push the images to your own Docker repository:

  1. Clone the repository to your machine:

    git clone https://github.com/otechdo/zuu.git
    cd zuu/dockers
    
  2. Ensure Docker and Docker Compose are installed on your system:

  3. Edit the Dockerfiles according to your needs:

    • Navigate to the appropriate directories for each language (e.g., rust/Dockerfile, python/Dockerfile).
    • Make the necessary changes to each Dockerfile.
  4. Login to Docker Hub:

    • If you are not logged in already, log in to Docker Hub:
      docker login
      
  5. Build and push your images:

    • Use the following command to build and push all Docker images to your own repository:
      make -j 4 USERNAME="your_docker_username" REPO="your_repository_name"
      
  6. Verify your images on Docker Hub:

    • Once pushed, you can verify the images by logging into Docker Hub and navigating to your repository.

Continuous Integration

You can use both GitHub Actions and Travis CI for continuous integration (CI) to automate the build and testing process for the project.

GitHub Actions

  1. Create a .github/workflows/ci.yml file in your repository with the following configuration:
name: zuu
on:
  push:
    branches:
        - main
        - develop
  pull_request:
    branches:
      - main
      - develop
env:
  CARGO_TERM_COLOR: always
  TERM: xterm-256color
jobs:
  zuu:
    strategy:
      matrix:
        os: [ ubuntu-latest, ubuntu-22.04, ubuntu-20.04, macos-latest, macos-13, macos-12 ]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - name: deps
        run:  cargo install cargo-audit cargo-auditable cargo-deny cargo-outdated
      - name: installation
        run:  cargo install zuu --no-default-features --features rust
      - name: zuu
        run:  git checkout "${GITHUB_REF##*/}" && zuu

  1. Set up Docker credentials in GitHub Secrets:
    • Go to your repository’s Settings > Secrets.
    • Add DOCKER_USERNAME and DOCKER_PASSWORD with your Docker Hub credentials.

With this configuration, GitHub Actions will build and test your Docker images on every push or pull request to the main branch.

Travis CI

  1. Create a .travis.yml file in your repository:
language: minimal

services:
  - docker

before_script:
  - docker-compose --version
  - docker-compose up --build --abort-on-container-exit

script:
  - docker-compose run <your_test_service>

deploy:
  provider: script
  script: docker-compose push
  on:
    branch: main

env:
  global:
    - DOCKER_USERNAME=$DOCKER_USERNAME
    - DOCKER_PASSWORD=$DOCKER_PASSWORD
  1. Set up Docker credentials in Travis CI:
    • Go to your Travis CI project’s Settings.
    • Add DOCKER_USERNAME and DOCKER_PASSWORD as environment variables.

This Travis CI configuration will build and test the Docker images, and push them to Docker Hub when the main branch is updated.

Contributing

Contributions are welcome! To contribute to the project, follow these steps:

  1. Fork the project.
  2. Create a branch for your feature (git checkout -b feature/amazing-feature`).
  3. Commit your changes (git commit -m 'Add some amazing feature').
  4. Push to the branch (git push origin feature/amazing-feature).
  5. Open a Pull Request.

License

This project is licensed under the AGPL-3.0 License. See the LICENSE file for more details.

{
  "scripts": {
    "check-structure": "echo 'Check project structure'",  // Vous pouvez personnaliser cette commande
    "test": "jest",                                        // Ou "mocha" ou tout autre framework de test
    "format:check": "prettier --check .",                  // Utilisation de Prettier pour le formatage
    "generate-docs": "jsdoc -c jsdoc.conf.json",           // Génération de documentation avec JSDoc
    "lint": "eslint .",                                    // Utilisation d'ESLint pour la vérification du style
    "audit": "npm audit"                                   // Vérification des vulnérabilités
  }
}

Dependencies

~9–19MB
~265K SLoC