[MISC] Migrate multicontact perturbations to local variables #3173
Workflow file for this run
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: Generic | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| release: | |
| branches: | |
| - main | |
| types: [published] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| generic-cpu: | |
| name: ${{ matrix.OS }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.GS_BACKEND }}-${{ matrix.GS_ENABLE_NDARRAY == '0' && 'field' || 'ndarray' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # See official Github documentation for details: https://shorturl.at/NJgsj | |
| OS: ["ubuntu-24.04", "macos-15"] | |
| PYTHON_VERSION: ["3.10", "3.11", "3.12", "3.13"] | |
| GS_BACKEND: ["cpu"] | |
| GS_ENABLE_NDARRAY: ["1"] | |
| include: | |
| # CPU backend - dynamic array (other OSes) | |
| - OS: "ubuntu-22.04" | |
| PYTHON_VERSION: "3.12" | |
| GS_BACKEND: "cpu" | |
| GS_ENABLE_NDARRAY: "1" | |
| - OS: "ubuntu-24.04-arm" | |
| PYTHON_VERSION: "3.12" | |
| GS_BACKEND: "cpu" | |
| GS_ENABLE_NDARRAY: "1" | |
| - OS: "windows-2025" | |
| PYTHON_VERSION: "3.12" | |
| GS_BACKEND: "cpu" | |
| GS_ENABLE_NDARRAY: "1" | |
| # CPU backend - field array | |
| - OS: "ubuntu-24.04" | |
| PYTHON_VERSION: "3.12" | |
| GS_BACKEND: "cpu" | |
| GS_ENABLE_NDARRAY: "0" | |
| - OS: "ubuntu-24.04-arm" | |
| PYTHON_VERSION: "3.12" | |
| GS_BACKEND: "cpu" | |
| GS_ENABLE_NDARRAY: "0" | |
| - OS: "windows-2025" | |
| PYTHON_VERSION: "3.12" | |
| GS_BACKEND: "cpu" | |
| GS_ENABLE_NDARRAY: "0" | |
| - OS: "macos-15" | |
| PYTHON_VERSION: "3.12" | |
| GS_BACKEND: "cpu" | |
| GS_ENABLE_NDARRAY: "0" | |
| # GPU backend - field array | |
| - OS: "macos-15" | |
| PYTHON_VERSION: "3.12" | |
| GS_BACKEND: "gpu" | |
| GS_ENABLE_NDARRAY: "0" | |
| env: | |
| HF_HUB_DOWNLOAD_TIMEOUT: "60" | |
| FORCE_COLOR: "1" | |
| PY_COLORS: "1" | |
| GS_CACHE_FILE_PATH: ".cache/genesis" | |
| GS_ENABLE_NDARRAY: ${{ matrix.GS_ENABLE_NDARRAY }} | |
| GS_TORCH_FORCE_CPU_DEVICE: ${{ startsWith(matrix.OS, 'macos-') && '1' || '0' }} | |
| TI_OFFLINE_CACHE: "1" | |
| TI_OFFLINE_CACHE_CLEANING_POLICY: "never" | |
| TI_OFFLINE_CACHE_FILE_PATH: ".cache/taichi" | |
| TI_ENABLE_CUDA: ${{ matrix.GS_BACKEND == 'gpu' && '1' || '0' }} | |
| TI_ENABLE_METAL: ${{ matrix.GS_BACKEND == 'gpu' && '1' || '0' }} | |
| TI_ENABLE_OPENGL: "0" | |
| TI_ENABLE_VULKAN: "0" | |
| TI_DEBUG: "0" | |
| OMNI_KIT_ACCEPT_EULA: "yes" | |
| runs-on: ${{ matrix.OS }} | |
| if: github.event_name != 'release' | |
| steps: | |
| - name: Print system information (Windows) | |
| if: startsWith(matrix.OS, 'windows-') | |
| shell: pwsh | |
| run: | | |
| $cpu = Get-CimInstance -ClassName Win32_Processor | |
| $ram = Get-CimInstance -ClassName Win32_ComputerSystem | |
| [PSCustomObject]@{ | |
| CPU_Name = $cpu.Name | |
| Physical_Cores = ($cpu | Measure-Object -Property NumberOfCores -Sum).Sum | |
| Logical_Processors = ($cpu | Measure-Object -Property NumberOfLogicalProcessors -Sum).Sum | |
| Total_RAM_GB = [math]::Round($ram.TotalPhysicalMemory / 1GB, 2) | |
| } | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.PYTHON_VERSION }} | |
| - name: Install system dependencies (Windows) | |
| if: startsWith(matrix.OS, 'windows-') | |
| shell: bash | |
| run: | | |
| curl -L -o mesa.7z https://github.com/pal1000/mesa-dist-win/releases/download/25.1.5/mesa3d-25.1.5-release-msvc.7z | |
| 7z x mesa.7z -omesa | |
| mv -v mesa/x64/* /C/Windows/System32/ | |
| - name: Install Mesa 25 OpenGL driver (Linux) | |
| if: startsWith(matrix.OS, 'ubuntu-') | |
| run: | | |
| for retry in {1..10}; do | |
| sudo add-apt-repository -y ppa:kisak/kisak-mesa && break || sleep 5; | |
| done | |
| sudo apt install -y \ | |
| libglu1-mesa \ | |
| libegl-mesa0 \ | |
| libgl1-mesa-dev | |
| - name: Install python dependencies | |
| shell: bash | |
| run: | | |
| pip install --upgrade pip setuptools pkg-info wheel | |
| # FIXME: Must install torch>2.9.1 to support zerocopy on Apple Metal | |
| pip3 install torch --upgrade --index-url https://download.pytorch.org/whl/cpu | |
| - name: Install Genesis | |
| shell: bash | |
| run: | | |
| PYTHON_DEPS="dev" | |
| # Install USD for all platforms except ARM (usd-core doesn't support ARM) | |
| # This is required for test_mesh.py which tests USD parsing functionality | |
| if [[ "${{ matrix.OS }}" != 'ubuntu-24.04-arm' ]] ; then | |
| PYTHON_DEPS="${PYTHON_DEPS},usd" | |
| fi | |
| pip install -e ".[${PYTHON_DEPS}]" | |
| - name: Get artifact prefix name | |
| id: artifact_prefix | |
| shell: bash | |
| run: | | |
| OS_FAMILY=$(python -c "import platform; print(platform.system())") | |
| MACHINE_ARCH=$(python -c "import platform; print(platform.machine())") | |
| GSTAICHI_VERSION=$(python -c "import importlib.metadata ; print(importlib.metadata.version('gstaichi'))") | |
| echo "ARTIFACT_PREFIX=${OS_FAMILY}-${MACHINE_ARCH}-${GSTAICHI_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Restore Taichi Kernel Cache | |
| if: ${{ always() && steps.artifact_prefix.outputs.ARTIFACT_PREFIX != '' }} | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .cache | |
| key: ${{ steps.artifact_prefix.outputs.ARTIFACT_PREFIX }} | |
| restore-keys: | | |
| ${{ steps.artifact_prefix.outputs.ARTIFACT_PREFIX }}- | |
| - name: Run unit tests | |
| run: | | |
| pytest -v --logical --dev --backend ${{ matrix.GS_BACKEND }} -m 'required and not slow' --forked ./tests | |
| - name: Save Updated Taichi Kernel Cache | |
| if: >- | |
| ${{ always() && | |
| (matrix.OS == 'ubuntu-24.04' || matrix.OS == 'ubuntu-24.04-arm' || matrix.OS == 'macos-15' || matrix.OS == 'windows-2025') && | |
| matrix.PYTHON_VERSION == '3.12' && | |
| matrix.GS_BACKEND == 'cpu' && | |
| matrix.GS_ENABLE_NDARRAY == '1' && | |
| steps.artifact_prefix.outputs.ARTIFACT_PREFIX != '' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .cache | |
| # Note that it is necessary to create a new archive systematically for now: | |
| # See: https://github.com/actions/cache/issues/1594 | |
| key: ${{ steps.artifact_prefix.outputs.ARTIFACT_PREFIX }}-${{ github.run_id }}-${{ github.run_attempt }} | |
| publish-pypi: | |
| name: Publish on PyPI | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| id-token: write | |
| environment: | |
| name: advance | |
| if: github.event_name == 'release' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Build wheels | |
| run: | | |
| pip wheel --no-deps . -w wheelhouse | |
| - name: Publish the wheels on PyPI | |
| uses: pypa/gh-action-pypi-publish@v1.12.4 | |
| with: | |
| packages-dir: wheelhouse | |
| verify-metadata: true | |
| attestations: true | |
| print-hash: true | |
| skip-existing: true |