Skip to content

Commit

Permalink
[ci] Use local caches on self-hosted runners
Browse files Browse the repository at this point in the history
  • Loading branch information
feisuzhu committed Sep 8, 2022
1 parent d2e02b7 commit 466462a
Show file tree
Hide file tree
Showing 11 changed files with 655 additions and 592 deletions.
199 changes: 79 additions & 120 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,62 +74,44 @@ jobs:
with:
submodules: 'recursive'

- name: Get sccache cache
uses: actions/cache@v2
with:
path: sccache_cache
key: sccache-linux-gpu-${{ github.sha }}
restore-keys: |
sccache-linux-gpu-
- name: Prepare Environment
run: |
. .github/workflows/scripts/common-utils.sh
prepare-build-cache
echo CI_DOCKER_RUN_EXTRA_ARGS="-v $(pwd):/home/dev/taichi" >> $GITHUB_ENV
- name: Build
run: |
mkdir -m777 shared
docker create --user dev --name taichi_build --gpus all -v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY -e PY -e GPU_BUILD -e TAICHI_CMAKE_ARGS -e PROJECT_NAME \
registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.2 \
/home/dev/taichi/.github/workflows/scripts/unix_build.sh
tar -cf - ../${{ github.event.repository.name }} --mode u=+rwx,g=+rwx,o=+rwx --owner 1000 --group 1000 | docker cp - taichi_build:/home/dev/
docker start -a taichi_build
docker cp taichi_build:/home/dev/taichi/dist shared/dist
docker cp taichi_build:/home/dev/taichi/build shared/build
. .github/workflows/scripts/common-utils.sh
ci-docker-run-gpu --name taichi_build \
registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.3 \
/home/dev/taichi/.github/workflows/scripts/unix-build.sh
env:
PY: ${{ matrix.conda_python }}
GPU_BUILD: ON
TAICHI_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
PROJECT_NAME: ${{ matrix.name }}
DISPLAY: ':1'
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_OPENGL:BOOL=ON
-DTI_WITH_CC:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: shared/dist/*.whl
path: dist/*.whl
retention-days: 20

- name: Test
run: |
docker create --user dev --name taichi_test --gpus all -v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY -e PY -e GPU_TEST \
registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.2 \
/home/dev/unix_test.sh
docker cp .github/workflows/scripts/unix_test.sh taichi_test:/home/dev/unix_test.sh
docker cp .github/workflows/scripts/common-utils.sh taichi_test:/home/dev/common-utils.sh
docker cp ./requirements_test.txt taichi_test:/home/dev/requirements_test.txt
docker cp shared/dist/ taichi_test:/home/dev/
docker cp shared/build/ taichi_test:/home/dev/
docker cp pyproject.toml taichi_test:/home/dev/
docker cp tests/ taichi_test:/home/dev/
docker start -a taichi_test
. .github/workflows/scripts/common-utils.sh
ci-docker-run-gpu --name taichi_test \
registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.3 \
/home/dev/taichi/.github/workflows/scripts/unix_test.sh
env:
PY: ${{ matrix.conda_python }}
GPU_TEST: ON
DISPLAY: ':1'

- name: clean docker container
if: always()
run: |
docker rm taichi_build taichi_test -f

build_and_test_manylinux2014:
name: Build and Upload (manylinux2014)
Expand All @@ -143,30 +125,28 @@ jobs:
with:
submodules: "recursive"

- name: Get sccache cache
uses: actions/cache@v2
with:
path: sccache_cache
key: sccache-manylinux-${{ github.sha }}
restore-keys: |
sccache-manylinux-
- name: Prepare Environment
run: |
. .github/workflows/scripts/common-utils.sh
prepare-build-cache
echo CI_DOCKER_RUN_EXTRA_ARGS="-v $(pwd):/home/dev/taichi" >> $GITHUB_ENV
- name: Build
run: |
mkdir -m777 shared
docker create --user dev --name taichi_build --gpus all \
-e PY -e GPU_BUILD -e TAICHI_CMAKE_ARGS -e PROJECT_NAME \
registry.taichigraphics.com/taichidev-manylinux2014-cuda:v0.0.0 \
/home/dev/taichi/.github/workflows/scripts/unix_build.sh
tar -cf - ../${{ github.event.repository.name }} --mode u=+rwx,g=+rwx,o=+rwx --owner 1000 --group 1000 | docker cp - taichi_build:/home/dev/
docker start -a taichi_build
docker cp taichi_build:/home/dev/taichi/dist shared/dist
docker cp taichi_build:/home/dev/taichi/build shared/build
. .github/workflows/scripts/common-utils.sh
ci-docker-run-gpu --name taichi_test \
registry.taichigraphics.com/taichidev-manylinux2014-cuda:v0.0.0 \
/home/dev/taichi/.github/workflows/scripts/unix-build.sh
env:
PY: ${{ matrix.conda_python }}
GPU_BUILD: ON
TAICHI_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
PROJECT_NAME: ${{ matrix.name }}
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_OPENGL:BOOL=OFF
-DTI_WITH_CC:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=OFF
-DTI_BUILD_TESTS:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
Expand All @@ -177,28 +157,15 @@ jobs:

- name: Test
run: |
docker create --user dev --name taichi_test --gpus all -e TI_WANTED_ARCHS \
-e PY -e GPU_TEST \
registry.taichigraphics.com/taichidev-manylinux2014-cuda:v0.0.0 \
/home/dev/unix_test.sh
docker cp .github/workflows/scripts/unix_test.sh taichi_test:/home/dev/unix_test.sh
docker cp .github/workflows/scripts/common-utils.sh taichi_test:/home/dev/common-utils.sh
docker cp ./requirements_test.txt taichi_test:/home/dev/requirements_test.txt
docker cp shared/dist/ taichi_test:/home/dev/
docker cp shared/build/ taichi_test:/home/dev/
docker cp pyproject.toml taichi_test:/home/dev/
docker cp tests/ taichi_test:/home/dev/
docker start -a taichi_test
. .github/workflows/scripts/common-utils.sh
ci-docker-run-gpu --name taichi_test \
registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.3 \
/home/dev/taichi/.github/workflows/scripts/unix_test.sh
env:
PY: ${{ matrix.conda_python }}
GPU_TEST: ON
TI_WANTED_ARCHS: "cuda,cpu"

- name: clean docker container
if: always()
run: |
docker rm taichi_build taichi_test -f
build_and_test_mac:
name: Build and Upload (macOS only)
needs: matrix_prep
Expand All @@ -213,13 +180,10 @@ jobs:
with:
submodules: 'recursive'

- name: Get sccache cache
uses: actions/cache@v2
with:
path: sccache_cache
key: sccache-mac-${{ github.sha }}
restore-keys: |
sccache-mac-
- name: Prepare Environment
run: |
. .github/workflows/scripts/common-utils.sh
prepare-build-cache
- name: Download Pre-Built LLVM 10.0.0
run: python misc/ci_download.py
Expand All @@ -230,14 +194,15 @@ jobs:
run: |
brew install molten-vk
export PATH=$(pwd)/taichi-llvm/bin/:$PATH
export PATH=$(ls -d ~/mini*/envs/$PY/bin):$PATH
bash .github/workflows/scripts/unix_build.sh
brew uninstall molten-vk
echo PATH=$PATH >> $GITHUB_ENV
.github/workflows/scripts/unix-build.sh
env:
TAICHI_CMAKE_ARGS: -DTI_WITH_VULKAN:BOOL=ON -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
PROJECT_NAME: ${{ matrix.name }}
CXX: clang++
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_VULKAN:BOOL=ON
-DTI_WITH_OPENGL:BOOL=OFF
-DTI_WITH_CC:BOOL=OFF
-DTI_BUILD_TESTS:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -267,28 +232,25 @@ jobs:
with:
submodules: 'recursive'

- name: Get sccache cache
uses: actions/cache@v2
with:
path: sccache_cache
key: sccache-m1-${{ github.sha }}
restore-keys: |
sccache-m1-
- name: Prepare Environment
run: |
. .github/workflows/scripts/common-utils.sh
prepare-build-cache
- name: Build
run: |
brew install molten-vk
# We hacked here because conda activate in CI won't update python PATH
# automatically. So we don't activate and use desired python version
# directly.
export PATH=/Users/github/miniforge3/envs/$PYTHON/bin:$PATH
bash .github/workflows/scripts/unix_build.sh
brew uninstall molten-vk
.github/workflows/scripts/unix-build.sh
env:
TAICHI_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CUDA:BOOL=OFF -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
PROJECT_NAME: ${{ matrix.name }}
PYTHON: ${{ matrix.python }}
PY: ${{ matrix.python }}
CXX: clang++
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_OPENGL:BOOL=OFF
-DTI_WITH_CUDA:BOOL=OFF
-DTI_WITH_CC:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
Expand All @@ -299,11 +261,10 @@ jobs:

- name: Test
run: |
export PATH=/Users/github/miniforge3/envs/$PYTHON/bin:$PATH
.github/workflows/scripts/unix_test.sh
env:
TI_WANTED_ARCHS: 'metal,vulkan,cpu'
PYTHON: ${{ matrix.python }}
PY: ${{ matrix.python }}
GPU_TEST: ON

build_and_test_macos_1014:
Expand All @@ -318,28 +279,27 @@ jobs:
with:
submodules: 'recursive'

- name: Get sccache cache
uses: actions/cache@v2
with:
path: sccache_cache
key: sccache-1014-${{ github.sha }}
restore-keys: |
sccache-1014-
- name: Prepare Environment
run: |
. .github/workflows/scripts/common-utils.sh
prepare-build-cache
- name: Build
run: |
# We hacked here because conda activate in CI won't update python PATH
# automatically. So we don't activate and use desired python version
# directly.
export PATH=/Users/buildbot6/miniconda3/envs/$PYTHON/bin:$PATH
# TODO: should embed LLVM as submodule
export LLVM_DIR=/Users/buildbot6/taichi-llvm-10.0.0-macos
export PATH=$LLVM_DIR/bin:$PATH
bash .github/workflows/scripts/unix_build.sh
.github/workflows/scripts/unix-build.sh
env:
TAICHI_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CUDA:BOOL=OFF -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
PROJECT_NAME: ${{ matrix.name }}
PYTHON: ${{ matrix.python }}
PY: ${{ matrix.python }}
CXX: clang++
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_OPENGL:BOOL=OFF
-DTI_WITH_CUDA:BOOL=OFF
-DTI_WITH_CC:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=OFF
-DTI_BUILD_TESTS:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
Expand All @@ -350,11 +310,10 @@ jobs:

- name: Test
run: |
export PATH=/Users/buildbot6/miniconda3/envs/$PYTHON/bin:$PATH
.github/workflows/scripts/unix_test.sh
env:
TI_WANTED_ARCHS: 'cpu'
PYTHON: ${{ matrix.python }}
PY: ${{ matrix.python }}

build_and_test_windows:
name: Build and Upload (Windows only)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scripts/android-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ setup-sccache-local
setup_python
setup-android-ndk-env

python -m pip install -r requirements_dev.txt
python setup.py clean
python setup.py build_ext
cd build
Expand Down
Loading

0 comments on commit 466462a

Please sign in to comment.