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: Cache virtual environment id: cache-venv uses: actions/cache@v4 with: path: ${{ env.VENV_DIR }} key: ${{ runner.os }}-py${{ env.PYTHON_VERSION }}-venv-${{ hashFiles('**/requirements-dev.txt', '**/requirements-test.txt') }} - name: Create / ensure virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | python -m venv ${{ env.VENV_DIR }} source ${{ env.VENV_DIR }}/bin/activate python -m pip install --upgrade pip --no-user if [ -f requirements-test.txt ]; then PIP_NO_BUILD_ISOLATION=1 \ python -m pip install -r requirements-test.txt --no-user fi python -m pip install . --no-user - name: Update submodules recursively run: git submodule update --init --recursive - name: Run format check run: | source ${{ 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: Cache virtual environment id: cache-venv uses: actions/cache@v4 with: path: ${{ env.VENV_DIR }} key: ${{ runner.os }}-py${{ env.PYTHON_VERSION }}-venv-${{ hashFiles('**/requirements-dev.txt', '**/requirements-test.txt') }} - name: Create / ensure virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | python -m venv ${{ env.VENV_DIR }} source ${{ env.VENV_DIR }}/bin/activate python -m pip install --upgrade pip --no-user if [ -f requirements-test.txt ]; then PIP_NO_BUILD_ISOLATION=1 \ python -m pip install -r requirements-test.txt --no-user fi python -m pip install . --no-user - name: Install project in wheel mode run: | source ${{ env.VENV_DIR }}/bin/activate python -m pip install . --no-user - name: Run examples run: | source ${{ env.VENV_DIR }}/bin/activate cd examples unset PYTHONPATH python -m pytest -n 4 **/test*.py - name: Run tests run: | source ${{ env.VENV_DIR }}/bin/activate cd testing/python unset PYTHONPATH python -m pytest -n 4