name: CI on: [pull_request] env: PYTHON_VERSION: '3.9' VENV_DIR: tilelang_ci jobs: format-check: runs-on: self-hosted steps: - name: Checkout repository uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v2 with: python-version: ${{ env.PYTHON_VERSION }} - name: Ensure venv (local & persistent) run: | set -e REQS_HASH=$(cat requirements-test.txt 2>/dev/null || true) MARKER="${{ runner.tool_cache }}/.venv_marker_${{ env.PYTHON_VERSION }}_${REQS_HASH:0:8}" if [[ -f "$MARKER" ]] && [[ -f "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" ]]; then echo "venv exists and hash matches – reuse it" else echo "venv stale or missing – recreating" rm -rf "${{ runner.tool_cache }}/${{ env.VENV_DIR }}" "$MARKER" python -m venv "${{ runner.tool_cache }}/${{ env.VENV_DIR }}" # shellcheck source=/dev/null source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" python -m pip install --upgrade pip --no-user [[ -f requirements-test.txt ]] && \ PIP_NO_BUILD_ISOLATION=1 pip install -r requirements-test.txt --no-user pip install . --no-user touch "$MARKER" fi - name: Update submodules run: git submodule update --init --recursive - name: Run format check run: | source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" ./format.sh build-test: runs-on: self-hosted needs: format-check steps: - name: Checkout repository uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v2 with: python-version: ${{ env.PYTHON_VERSION }} - name: Ensure venv (local & persistent) run: | set -e REQS_HASH=$(cat requirements-test.txt 2>/dev/null || true) MARKER="${{ runner.tool_cache }}/.venv_marker_${{ env.PYTHON_VERSION }}_${REQS_HASH:0:8}" if [[ -f "$MARKER" ]] && [[ -f "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" ]]; then echo "venv exists and hash matches – reuse it" else echo "venv stale or missing – recreating" rm -rf "${{ runner.tool_cache }}/${{ env.VENV_DIR }}" "$MARKER" python -m venv "${{ runner.tool_cache }}/${{ env.VENV_DIR }}" source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" python -m pip install --upgrade pip --no-user [[ -f requirements-test.txt ]] && \ PIP_NO_BUILD_ISOLATION=1 pip install -r requirements-test.txt --no-user pip install . --no-user touch "$MARKER" fi - name: Install project (wheel form) run: | source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" pip install . --no-user - name: Run examples run: | source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" cd examples unset PYTHONPATH python -m pytest -n 8 **/test*.py - name: Run tests run: | source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" cd testing/python unset PYTHONPATH python -m pytest -n 8