added pypi publish workflow #291
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: Test Python Package | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_call: | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| HF_HOME: ${{ github.workspace }}/.cache/huggingface | |
| HF_HUB_CACHE: ${{ github.workspace }}/.cache/huggingface/hub | |
| HF_HUB_DOWNLOAD_TIMEOUT: "60" | |
| HF_HUB_ETAG_TIMEOUT: "30" | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Setup UV with cache | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| - name: Cache huggingface | |
| id: hf-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/.cache/huggingface | |
| key: huggingface-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| huggingface- | |
| - name: Ensure Hugging Face cache directories exist | |
| run: | | |
| mkdir -p "$HF_HUB_CACHE" | |
| - name: Show Hugging Face cache status | |
| run: | | |
| echo "hf-cache-hit=${{ steps.hf-cache.outputs.cache-hit }}" | |
| echo "HF_HOME=$HF_HOME" | |
| ls -la "$(dirname "$HF_HOME")" || true | |
| du -sh "$HF_HOME" || true | |
| du -sh "$HF_HUB_CACHE" || true | |
| - name: Sync dependencies with uv | |
| run: uv sync | |
| - name: Run tests | |
| run: uv run pytest --cov=DeepSDFStruct --cov-report=term-missing --cov-report=xml tests | |
| - name: Show Hugging Face cache after tests | |
| if: always() | |
| run: | | |
| echo "Post-test Hugging Face cache usage" | |
| du -sh "$HF_HOME" || true | |
| du -sh "$HF_HUB_CACHE" || true | |
| - name: Coveralls | |
| if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' | |
| uses: coverallsapp/github-action@v2 |