53 lines
1.7 KiB
Markdown
53 lines
1.7 KiB
Markdown
# CI Pipeline — ${REPO_NAME}
|
|
|
|
## Overview
|
|
|
|
The CI workflow (`.gitea/workflows/ci.yml`) runs on every push and pull request.
|
|
It auto-detects the project type and runs the appropriate tools.
|
|
|
|
## Detection Logic
|
|
|
|
The workflow checks for project files in this order:
|
|
|
|
### Python Detection
|
|
- **Trigger**: `requirements.txt`, `setup.py`, or `pyproject.toml` exists
|
|
- **Actions**:
|
|
1. Set up Python 3.x
|
|
2. `pip install -r requirements.txt` (if present)
|
|
3. Install dev tools: ruff, black, flake8, pytest
|
|
4. **Lint**: Run ruff, black --check, and flake8 (each skipped if not installed)
|
|
5. **Test**: Run pytest (only if `tests/` dir or pytest config detected)
|
|
|
|
### Node.js Detection
|
|
- **Trigger**: `package.json` exists
|
|
- **Actions**:
|
|
1. Set up Node.js (LTS)
|
|
2. `npm ci`
|
|
3. **Lint**: `npm run lint` (only if "lint" script exists in package.json)
|
|
4. **Test**: `npm test` (only if "test" script exists)
|
|
5. **Build**: `npm run build` (only if "build" script exists)
|
|
|
|
### No Project Detected
|
|
- If neither Python nor Node.js files are found, the workflow prints a message
|
|
and exits successfully. **It never fails due to missing language detection.**
|
|
|
|
## Strict Mode
|
|
|
|
Controlled by `CI_STRICT` in `.ci/config.env`:
|
|
|
|
| CI_STRICT | Behavior |
|
|
|-----------|----------|
|
|
| `true` (default) | Lint/test failures cause the workflow to fail |
|
|
| `false` | Failures are logged as warnings; workflow succeeds |
|
|
|
|
Use `CI_STRICT=false` during early development when you want visibility
|
|
into issues without blocking merges.
|
|
|
|
## Adding Support for Other Languages
|
|
|
|
To add support for another language (Go, Rust, etc.):
|
|
|
|
1. Add a detection step similar to the Python/Node checks.
|
|
2. Add setup, lint, and test steps conditional on detection.
|
|
3. Follow the same CI_STRICT pattern for error handling.
|