@@ -2,6 +2,10 @@ name: CI
22
33on : [pull_request]
44
5+ env :
6+ PYTHON_VERSION : ' 3.9'
7+ VENV_DIR : tilelang_ci
8+
59jobs :
610 format-check :
711 runs-on : self-hosted
@@ -15,23 +19,33 @@ jobs:
1519 - name : Set up Python
1620 uses : actions/setup-python@v2
1721 with :
18- python-version : ' 3.9 '
22+ python-version : ${{ env.PYTHON_VERSION }}
1923
20- - name : Create virtual environment
21- run : python -m venv tilelang_ci
24+ - name : Cache virtual environment
25+ id : cache-venv
26+ uses : actions/cache@v4
27+ with :
28+ path : ${{ env.VENV_DIR }}
29+ key : ${{ runner.os }}-py${{ env.PYTHON_VERSION }}-venv-${{ hashFiles('**/requirements-dev.txt', '**/requirements-test.txt') }}
2230
23- - name : Activate virtual environment and install dependencies
31+ - name : Create / ensure virtual environment
32+ if : steps.cache-venv.outputs.cache-hit != 'true'
2433 run : |
25- source tilelang_ci/bin/activate
34+ python -m venv ${{ env.VENV_DIR }}
35+ source ${{ env.VENV_DIR }}/bin/activate
2636 python -m pip install --upgrade pip --no-user
27- if [ -f requirements-dev.txt ]; then python -m pip install -r requirements-dev.txt --no-user; fi
37+ if [ -f requirements-test.txt ]; then
38+ PIP_NO_BUILD_ISOLATION=1 \
39+ python -m pip install -r requirements-test.txt --no-user
40+ fi
41+ python -m pip install . --no-user
2842
2943 - name : Update submodules recursively
3044 run : git submodule update --init --recursive
3145
3246 - name : Run format check
3347 run : |
34- source tilelang_ci /bin/activate
48+ source ${{ env.VENV_DIR }} /bin/activate
3549 ./format.sh
3650
3751 build-test :
@@ -47,32 +61,42 @@ jobs:
4761 - name : Set up Python
4862 uses : actions/setup-python@v2
4963 with :
50- python-version : ' 3.9 '
64+ python-version : ${{ env.PYTHON_VERSION }}
5165
52- - name : Create virtual environment
53- run : python -m venv tilelang_ci
66+ - name : Cache virtual environment
67+ id : cache-venv
68+ uses : actions/cache@v4
69+ with :
70+ path : ${{ env.VENV_DIR }}
71+ key : ${{ runner.os }}-py${{ env.PYTHON_VERSION }}-venv-${{ hashFiles('**/requirements-dev.txt', '**/requirements-test.txt') }}
5472
55- - name : Activate virtual environment and install dependencies
73+ - name : Create / ensure virtual environment
74+ if : steps.cache-venv.outputs.cache-hit != 'true'
5675 run : |
57- source tilelang_ci/bin/activate
76+ python -m venv ${{ env.VENV_DIR }}
77+ source ${{ env.VENV_DIR }}/bin/activate
5878 python -m pip install --upgrade pip --no-user
59- if [ -f requirements-test.txt ]; then PIP_NO_BUILD_ISOLATION=1 python -m pip install -r requirements-test.txt --no-user; fi
79+ if [ -f requirements-test.txt ]; then
80+ PIP_NO_BUILD_ISOLATION=1 \
81+ python -m pip install -r requirements-test.txt --no-user
82+ fi
83+ python -m pip install . --no-user
6084
6185 - name : Install project in wheel mode
6286 run : |
63- source tilelang_ci /bin/activate
87+ source ${{ env.VENV_DIR }} /bin/activate
6488 python -m pip install . --no-user
6589
6690 - name : Run examples
6791 run : |
68- source tilelang_ci /bin/activate
92+ source ${{ env.VENV_DIR }} /bin/activate
6993 cd examples
7094 unset PYTHONPATH
71- python -m pytest **/test*.py
95+ python -m pytest -n 4 **/test*.py
7296
7397 - name : Run tests
7498 run : |
75- source tilelang_ci /bin/activate
99+ source ${{ env.VENV_DIR }} /bin/activate
76100 cd testing/python
77101 unset PYTHONPATH
78- python -m pytest
102+ python -m pytest -n 4
0 commit comments