ci: use glob pattern for hashFiles to avoid path issues #66
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
| name: Tests | |
| on: | |
| push: | |
| pull_request: | |
| release: | |
| types: [created] | |
| jobs: | |
| tests: | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Install platformdirs for cache setup | |
| run: uv pip install --system platformdirs | |
| - name: Get model cache directory | |
| id: model-cache-dir | |
| shell: python | |
| run: | | |
| from platformdirs import PlatformDirs | |
| import os | |
| cache_dir = PlatformDirs(appname='iscc-sct', appauthor='iscc').user_data_dir | |
| print(f"dir={cache_dir}") | |
| with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | |
| print(f"dir={cache_dir}", file=fh) | |
| - name: Cache ONNX models | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.model-cache-dir.outputs.dir }} | |
| key: ${{ runner.os }}-onnx-models-${{ hashFiles('**/models_config.py') }} | |
| restore-keys: | | |
| ${{ runner.os }}-onnx-models- | |
| - name: Install Dependencies | |
| run: uv sync --extra demo --group dev | |
| - name: Install ONNX models | |
| run: uv run iscc-sct install --quiet | |
| - name: Run Tests | |
| run: uv run pytest --cov=iscc_sct --cov-report=xml -v tests |