diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14566ac..8842cfe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,10 +46,40 @@ jobs: with: fetch-depth: 0 # Equivalent to GIT_STRATEGY: fetch - - name: Setup & Run tests + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Ensure persistent venv and install dependencies run: | - source ~/miniconda3/etc/profile.d/conda.sh - conda activate tileops-release + set -e + VENV_DIR="tileops_venv" + REQS_HASH=$(sha256sum requirements.txt 2>/dev/null | awk '{print $1}' || echo "no_requirements") + MARKER="${{ runner.tool_cache }}/.venv_marker_${{ runner.os }}_${REQS_HASH:0:8}" + + if [[ -f "$MARKER" ]] && [[ -f "${{ runner.tool_cache }}/${VENV_DIR}/bin/activate" ]]; then + echo "Found cached venv and matching marker — reusing" + else + echo "Cached venv missing or stale — creating at ${{ runner.tool_cache }}/${VENV_DIR}" + rm -rf "${{ runner.tool_cache }}/${VENV_DIR}" "$MARKER" + python -m venv "${{ runner.tool_cache }}/${VENV_DIR}" + # shellcheck source=/dev/null + source "${{ runner.tool_cache }}/${VENV_DIR}/bin/activate" + python -m pip install --upgrade pip setuptools wheel --no-user + if [[ -f requirements.txt ]]; then + PIP_NO_BUILD_ISOLATION=1 pip install -r requirements.txt --no-user + else + echo "requirements.txt not found — skipping pip install -r requirements.txt" + fi + touch "$MARKER" + fi + shell: bash + + - name: Run tests + run: | + VENV_DIR="tileops_venv" + source "${{ runner.tool_cache }}/${VENV_DIR}/bin/activate" export PYTHONPATH="$(pwd):$PYTHONPATH" echo "PYTHONPATH=$PYTHONPATH" bash tests/ci_test.sh tileops_test_release.log @@ -74,10 +104,56 @@ jobs: with: fetch-depth: 0 # Equivalent to GIT_STRATEGY: fetch - - name: Setup & Run tests + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Ensure persistent venv and install dependencies run: | - source ~/miniconda3/etc/profile.d/conda.sh - conda activate tileops-nightly + set -e + VENV_DIR="tileops_venv_nightly" + REQS_HASH=$(sha256sum requirements.txt 2>/dev/null | awk '{print $1}' || echo "no_requirements") + MARKER="${{ runner.tool_cache }}/.venv_marker_${{ runner.os }}_${REQS_HASH:0:8}" + + if [[ -f "$MARKER" ]] && [[ -f "${{ runner.tool_cache }}/${VENV_DIR}/bin/activate" ]]; then + echo "Found cached venv and matching marker — reusing" + else + echo "Cached venv missing or stale — creating at ${{ runner.tool_cache }}/${VENV_DIR}" + rm -rf "${{ runner.tool_cache }}/${VENV_DIR}" "$MARKER" + python -m venv "${{ runner.tool_cache }}/${VENV_DIR}" + # shellcheck source=/dev/null + source "${{ runner.tool_cache }}/${VENV_DIR}/bin/activate" + retry_cmd() { + tries=0 + until [ $tries -ge 5 ] + do + if "$@"; then + return 0 + fi + tries=$((tries+1)) + echo "Command failed. Retrying $tries/5..." + sleep 2 + done + echo "Command failed after 5 attempts." >&2 + return 1 + } + + python -m pip install --upgrade pip setuptools wheel --no-user + if [[ -f requirements.txt ]]; then + export PIP_NO_BUILD_ISOLATION=1 pip install -r requirements.txt --no-user + retry_cmd pip install git+https://github.com/tile-ai/tilelang.git --no-user + else + echo "requirements.txt not found — skipping pip install -r requirements.txt" + fi + touch "$MARKER" + fi + shell: bash + + - name: Run tests + run: | + VENV_DIR="tileops_venv_nightly" + source "${{ runner.tool_cache }}/${VENV_DIR}/bin/activate" export PYTHONPATH="$(pwd):$PYTHONPATH" echo "PYTHONPATH=$PYTHONPATH" bash tests/ci_test.sh tileops_test_nightly.log diff --git a/requirements.txt b/requirements.txt index 068d605..7218c7f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,7 @@ typing_extensions>=4.10.0 cloudpickle ml_dtypes psutil -torch +torch==2.9.0 einops -tilelang>=0.1.7 +tilelang==0.1.7.post1 +pytest==9.0.2