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
104 downloads per month
120KB
2.5K
SLoC
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
- Docker (version >= 20.10)
- Docker Compose (version >= 1.29)
- Rust and Cargo (for local development)
Installation
-
Clone the repository to your machine:
git clone https://github.com/otechdo/zuu.git cd zuu
-
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
- 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
- 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:
-
Clone the repository to your machine:
git clone https://github.com/otechdo/zuu.git cd zuu/dockers
-
Ensure Docker and Docker Compose are installed on your system:
- Docker: Install Docker
- Docker Compose: Install Docker Compose
-
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.
- Navigate to the appropriate directories for each language (e.g.,
-
Login to Docker Hub:
- If you are not logged in already, log in to Docker Hub:
docker login
- If you are not logged in already, log in to Docker Hub:
-
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"
- Use the following command to build and push all Docker images to your own repository:
-
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
- 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
- Set up Docker credentials in GitHub Secrets:
- Go to your repository’s Settings > Secrets.
- Add
DOCKER_USERNAME
andDOCKER_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
- 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
- Set up Docker credentials in Travis CI:
- Go to your Travis CI project’s Settings.
- Add
DOCKER_USERNAME
andDOCKER_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:
- Fork the project.
- Create a branch for your feature (git checkout -b feature/amazing-feature`).
- Commit your changes (
git commit -m 'Add some amazing feature'
). - Push to the branch (
git push origin feature/amazing-feature
). - 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