Unverified Commit c12eb181 authored by Lei Wang's avatar Lei Wang Committed by GitHub
Browse files

[CI] Enable cache for virtual env and parallelize pytest via xdist (#660)

parent e9a608e2
...@@ -2,6 +2,10 @@ name: CI ...@@ -2,6 +2,10 @@ name: CI
on: [pull_request] on: [pull_request]
env:
PYTHON_VERSION: '3.9'
VENV_DIR: tilelang_ci
jobs: jobs:
format-check: format-check:
runs-on: self-hosted runs-on: self-hosted
...@@ -15,23 +19,33 @@ jobs: ...@@ -15,23 +19,33 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: '3.9' python-version: ${{ env.PYTHON_VERSION }}
- name: Create virtual environment - name: Cache virtual environment
run: python -m venv tilelang_ci 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: Activate virtual environment and install dependencies - name: Create / ensure virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: | run: |
source tilelang_ci/bin/activate python -m venv ${{ env.VENV_DIR }}
source ${{ env.VENV_DIR }}/bin/activate
python -m pip install --upgrade pip --no-user python -m pip install --upgrade pip --no-user
if [ -f requirements-dev.txt ]; then python -m pip install -r requirements-dev.txt --no-user; fi 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 - name: Update submodules recursively
run: git submodule update --init --recursive run: git submodule update --init --recursive
- name: Run format check - name: Run format check
run: | run: |
source tilelang_ci/bin/activate source ${{ env.VENV_DIR }}/bin/activate
./format.sh ./format.sh
build-test: build-test:
...@@ -47,32 +61,42 @@ jobs: ...@@ -47,32 +61,42 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: '3.9' python-version: ${{ env.PYTHON_VERSION }}
- name: Create virtual environment - name: Cache virtual environment
run: python -m venv tilelang_ci 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: Activate virtual environment and install dependencies - name: Create / ensure virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: | run: |
source tilelang_ci/bin/activate python -m venv ${{ env.VENV_DIR }}
source ${{ env.VENV_DIR }}/bin/activate
python -m pip install --upgrade pip --no-user 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 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 - name: Install project in wheel mode
run: | run: |
source tilelang_ci/bin/activate source ${{ env.VENV_DIR }}/bin/activate
python -m pip install . --no-user python -m pip install . --no-user
- name: Run examples - name: Run examples
run: | run: |
source tilelang_ci/bin/activate source ${{ env.VENV_DIR }}/bin/activate
cd examples cd examples
unset PYTHONPATH unset PYTHONPATH
python -m pytest **/test*.py python -m pytest -n 4 **/test*.py
- name: Run tests - name: Run tests
run: | run: |
source tilelang_ci/bin/activate source ${{ env.VENV_DIR }}/bin/activate
cd testing/python cd testing/python
unset PYTHONPATH unset PYTHONPATH
python -m pytest python -m pytest -n 4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment