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
# 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" | |
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: 🏞️ Activate virtual environment | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
source .venv\\Scripts\\activate | |
# echo PATH=$PATH >> $GITHUB_ENV | |
# echo PATH=$PATH:${{ runner.temp }}\\.venv\\Scripts >> $GITHUB_ENV | |
echo PATH=$PATH;.venv\\Scripts >> $GITHUB_ENV | |
else | |
source .venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
fi | |
shell: bash | |
# - name: add path to PATH environment variable | |
# uses: myci-actions/export-env-var@1 | |
# with: | |
# name: PATH | |
# value: $PATH:/some/path | |
- name: 🧹 Lint with ruff @astral-sh | |
uses: astral-sh/ruff-action@v1 | |
with: | |
args: "format --check" | |
continue-on-error: true | |
- name: 📥 Install pytest-action dependencies | |
run: 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: 📊 Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
continue-on-error: true | |
- name: ✅ Pylance type checking @jakebailey | |
uses: jakebailey/pyright-action@v2 | |
with: | |
pylance-version: latest-release | |
stats: true | |
# verbose: true | |
continue-on-error: true | |
- 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 |