π§ Pytest CI #11
This file contains 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
# Build Workflow | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: π¦ Nested Dict Tools CI build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/pip | |
# - os: macos-latest | |
# path: ~/Library/Caches/pip | |
# - os: windows-latest | |
# path: ~\AppData\Local\pip\Cache | |
python-version: ["3.12", "3.13"] # ["3.10", "3.11", "3.12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: ποΈ Checkout | |
uses: actions/checkout@v4 | |
- name: π Install uv with caching | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
version: "0.5.4" | |
- name: π Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: πΎ Setup pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('uv.lock') }} | |
restore-keys: ${{ runner.os }}-pip- | |
- name: π₯ Install the project | |
run: uv sync --all-extras --dev | |
- name: π§Ή Lint with ruff @chartboost | |
uses: chartboost/ruff-action@v1 | |
continue-on-error: true | |
- name: π₯ Install pytest-action dependencies | |
run: | | |
pipx install pytest pytest-cov | |
uv pip install pytest-md pytest-emoji | |
- name: π§ͺ Run pytest @pavelzw | |
uses: pavelzw/pytest-action@v2 | |
with: | |
custom-arguments: "tests -rA --doctest-modules --cov=." | |
continue-on-error: true | |
- name: π§ͺ Run Pytest with command | |
run: pytest tests -rA --doctest-modules --cov=. | |
continue-on-error: true | |
- name: π Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
# file: .coverage | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: β Pylance type checking @jakebailey | |
uses: jakebailey/pyright-action@v2 | |
with: | |
pylance-version: latest-release | |
stats: true | |
# verbose: true | |
continue-on-error: true | |
# - name: π₯ Install public interface package | |
# run: | | |
# python -m pip install . | |
- name: β Verify public API types with Pylance @jakebailey | |
uses: jakebailey/pyright-action@v2 | |
with: | |
pylance-version: latest-release | |
verify-types: nested_dict_tools | |
# verbose: true | |
continue-on-error: true | |
- name: ποΈ Build | |
run: | | |
pipx install hatch | |
hatch build |