β¨ Introduce iter_leaves, iter_leaf_container and is_in_leaves #117
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: | |
python-version: | |
- "3.12" | |
# - "3.13" | |
os: | |
- ubuntu-latest | |
# - macos-latest | |
# - windows-latest | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/pip | |
# - os: macos-latest | |
# path: ~/Library/Caches/pip | |
# - os: windows-latest | |
# path: ~\AppData\Local\pip\Cache | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
UV_SYSTEM_PYTHON: 1 | |
steps: | |
- name: ποΈ Checkout | |
uses: actions/checkout@v4 | |
- name: π Install uv with caching | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
- 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 | |
uv pip install pipx # Problems with ruff action without this | |
else | |
source .venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
fi | |
- name: π§Ή Lint with ruff @astral-sh | |
uses: astral-sh/ruff-action@v1 | |
continue-on-error: true | |
- name: πͺ Format with ruff @astral-sh | |
uses: astral-sh/ruff-action@v1 | |
with: | |
args: "format --diff" | |
continue-on-error: true | |
- name: π§ͺ Run Pytest with doctest | |
env: | |
REPORT_OUTPUT: md_report.md | |
run: | | |
echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV" | |
pytest --doctest-modules --md-report --md-report-flavor gfm --md-report-output "$REPORT_OUTPUT" --cov=. # -rA | |
- name: π§ͺ Add test output reports to the job summary | |
run: | | |
if [ -f "$REPORT_FILE" ]; then | |
echo "<details><summary>Test Report</summary>" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
cat "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "</details>" >> $GITHUB_STEP_SUMMARY | |
fi | |
- name: π Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: β Type checking with BasedPyright | |
run: | | |
uv pip install pytest hatchling # For some reason basedpyright doesn't find those packages | |
basedpyright # --stats | |
continue-on-error: true | |
- name: β Verify public API types with BasedPyright | |
run: | | |
uv pip install . | |
basedpyright --verifytypes nested_dict_tools | |
continue-on-error: true | |
- name: ποΈ Build | |
run: | | |
pipx install hatch | |
hatch build |