CI #441
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license | |
# Continuous Integration (CI) GitHub Actions tests | |
name: CI | |
permissions: | |
contents: read # Read code in PRs | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: "0 0 * * *" # Runs at 00:00 UTC every day | |
jobs: | |
Test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: false | |
- name: Install dependencies | |
run: | | |
uv pip install --system -e ".[dev]" | |
- name: Option 1 - Python tests with pytest | |
run: | | |
python -m pytest tests -v | |
- name: Option 2 - Python tests with unittest | |
run: | | |
python -m unittest discover tests -v | |
- name: Option 3 - Python tests with pytest coverage | |
run: | | |
python -m pytest tests -v --cov=./ --cov-report=xml:pytest-coverage.xml | |
- name: Option 4 - Python tests with unittest coverage | |
run: | | |
python -m coverage run --source=./ -m unittest discover tests -v && python -m coverage xml -o unittest-coverage.xml | |
- name: Run CLI tests | |
run: | | |
example-cli-command | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./pytest-coverage.xml,./unittest-coverage.xml # optional (default = coverage.xml) | |
flags: template_coverage # optional | |
fail_ci_if_error: True # optional (default = false) | |
verbose: false # optional (default = false) |