test: init_func #75
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
name: test | |
on: | |
push: | |
branches: [dev] | |
paths: | |
- "**.py" | |
- ".github/workflows/check.yaml" | |
- "pyproject.toml" | |
pull_request: | |
branches: [dev, main] | |
paths: | |
- "**.py" | |
- ".github/workflows/check.yaml" | |
- "pyproject.toml" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
UV_CACHE_DIR: /tmp/.uv-cache | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
name: check ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Set up Python ${{ matrix.python-version }} | |
id: setup-python | |
run: | | |
uv python install ${{ matrix.python-version }} | |
uv python pin ${{ matrix.python-version }} | |
uv lock | |
PY=$(uv run python -VV | shasum -a 256 | cut -d' ' -f1) | |
echo PY: $PY | |
echo "PY=$PY" >> "$GITHUB_OUTPUT" | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
id: uv-cache | |
with: | |
path: ${{ env.UV_CACHE_DIR }} | |
key: uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }} | |
uv-${{ steps.setup-python.outputs.PY }} | |
- name: Install dependencies | |
if: steps.uv-cache.outputs.cache-hit != 'true' | |
run: uv sync | |
- name: Test with pytest | |
run: | | |
uv run pytest | |
- name: Minimize uv cache | |
run: uv cache prune --ci |