name: CI on: push: branches: [main, master] paths: - '**.py' - 'pyproject.toml' - 'requirements.txt' - '.gitea/workflows/ci.yml' pull_request: branches: [main, master] jobs: test: runs-on: ubuntu-latest strategy: matrix: python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e ".[dev]" - name: Run tests with pytest run: | pytest tests/ -v --tb=short - name: Upload coverage report if: matrix.python-version == '3.11' uses: codecov/codecov-action@v3 with: files: ./coverage.xml flags: unittests name: codecov-umbrella lint: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' - name: Install ruff run: pip install ruff - name: Run ruff linting run: ruff check . - name: Check formatting run: ruff format --check . type-check: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' - name: Install dependencies run: pip install -e ".[dev]" - name: Run type checking with mypy run: pip install mypy && mypy src/ --ignore-missing-imports build: runs-on: ubuntu-latest needs: [test, lint, type-check] steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' - name: Install build run: pip install build - name: Build package run: python -m build - name: Verify package run: | pip install dist/*.whl api-mock --help