diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9a9d4a909975e1..1d069a38620c2e 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -104,6 +104,241 @@ jobs: CR_PAT: ${{ secrets.GITHUB_TOKEN }} CI_SETUP_CMAKE_ARGS: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=OFF + build_and_test_cpu_linux: + name: Build and Test linux (CPU) + needs: check_files + timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 90 || 120 }} + strategy: + matrix: + include: + - os: ubuntu-latest + python: py39 + with_cc: ON + wanted_archs: 'cpu,cc' + - os: ubuntu-latest + python: py310 + with_cc: ON + wanted_archs: 'cpu,cc' + runs-on: ${{ matrix.os }} + permissions: + packages: read + contents: read + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: '0' + submodules: 'recursive' + + - name: Get Build Cache + uses: actions/cache@v2 + with: + path: /tmp/build-cache + key: build-cache-linux-${{ github.sha }} + restore-keys: | + build-cache-linux- + + - name: Prepare Environment + run: | + . .github/workflows/scripts/common-utils.sh + prepare-build-cache /tmp/build-cache + echo CI_DOCKER_RUN_EXTRA_ARGS="-v $(pwd):/home/dev/taichi" >> $GITHUB_ENV + sudo -n chown -R 1000:1000 . || true + + - name: Get Docker Images + if: needs.check_files.outputs.run_job == 'true' + run: | + # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio + docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} + docker pull ghcr.io/taichi-dev/taichidev-cpu-ubuntu18.04:v0.3.3 + + - name: Build + if: needs.check_files.outputs.run_job == 'true' + run: | + . .github/workflows/scripts/common-utils.sh + ci-docker-run \ + ghcr.io/taichi-dev/taichidev-cpu-ubuntu18.04:v0.3.3 \ + /home/dev/taichi/.github/workflows/scripts/unix-build.sh + + env: + PY: ${{ matrix.python }} + PROJECT_NAME: taichi + TAICHI_CMAKE_ARGS: >- + -DTI_WITH_OPENGL:BOOL=OFF + -DTI_WITH_CC:BOOL=${{ matrix.with_cc }} + -DTI_WITH_VULKAN:BOOL=OFF + -DTI_BUILD_TESTS:BOOL=ON + -DTI_WITH_C_API=ON + + - name: Test + id: test + if: needs.check_files.outputs.run_job == 'true' + run: | + . .github/workflows/scripts/common-utils.sh + ci-docker-run \ + ghcr.io/taichi-dev/taichidev-cpu-ubuntu18.04:v0.3.3 \ + /home/dev/taichi/.github/workflows/scripts/unix_test.sh + env: + PY: ${{ matrix.python }} + TI_WANTED_ARCHS: ${{ matrix.wanted_archs }} + + - name: Save wheel if test failed + if: failure() && steps.test.conclusion == 'failure' + uses: actions/upload-artifact@v3 + with: + name: broken-wheel + path: dist/* + retention-days: 7 + + - name: Fix Cache Permissions + run: | + sudo -n chmod -R 0777 /tmp/build-cache || true + + build_and_test_cpu_mac: + name: Build and Test macos (CPU) + needs: check_files + timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 60 || 120 }} + strategy: + matrix: + include: + - os: macos-10.15 + python: 3.7 + with_cc: OFF + with_cpp_tests: ON + wanted_archs: 'cpu,vulkan' + runs-on: + - self-hosted + - ${{ matrix.os }} + env: + PY: ${{ matrix.python }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: '0' + submodules: 'recursive' + + - name: Prepare Environment + run: | + . .github/workflows/scripts/common-utils.sh + prepare-build-cache + python misc/ci_download.py + env: + CI_PLATFORM: macos + + - name: Build & Install + if: needs.check_files.outputs.run_job == 'true' + run: | + brew install molten-vk + .github/workflows/scripts/unix-build.sh + env: + CXX: clang++ + TAICHI_CMAKE_ARGS: >- + -DTI_WITH_OPENGL:BOOL=OFF + -DTI_WITH_CC:BOOL=${{ matrix.with_cc }} + -DTI_WITH_VULKAN:BOOL=ON + -DTI_WITH_C_API=ON + -DTI_BUILD_TESTS:BOOL=${{ matrix.with_cpp_tests }} + + # [DEBUG] Copy this step around to enable debugging inside Github Action instances. + #- name: Setup tmate session + # uses: mxschmitt/action-tmate@v3 + # with: + # limit-access-to-actor: true + + - name: Test + id: test + if: needs.check_files.outputs.run_job == 'true' + run: .github/workflows/scripts/unix_test.sh + env: + TI_WANTED_ARCHS: ${{ matrix.wanted_archs }} + TI_SKIP_CPP_TESTS: Disabled because Vulkan is supported but not working on buildbot4 + + - name: Save wheel if test failed + if: failure() && steps.test.conclusion == 'failure' + uses: actions/upload-artifact@v3 + with: + name: broken-wheel + path: dist/* + retention-days: 7 + + build_and_test_cpu_windows: + name: Build and Test Windows (CPU) + needs: check_files + strategy: + matrix: + include: + - os: windows-2019 + llvmVer : '15' + - os: windows-2019 + llvmVer : '10' + timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 90 || 180 }} + runs-on: windows-2019 + permissions: + packages: read + contents: read + env: + PY: "3.7" + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: '0' + submodules: 'recursive' + + - name: Get Build Cache + uses: actions/cache@v3 + if: needs.check_files.outputs.run_job == 'true' + with: + # env.LocalAppData is not usable according to actions/cache README + path: ~/AppData/Local/build-cache + key: build-cache-win64-cpu-${{ github.sha }} + restore-keys: | + build-cache-win64-cpu- + + - name: Prepare Environment + shell: pwsh + if: needs.check_files.outputs.run_job == 'true' + run: | + . .github/workflows/scripts/common-utils.ps1 + Invoke docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} + Invoke docker pull ghcr.io/taichi-dev/taichidev-cpu-windows:v0.0.2 + PrepareBuildCache + echo CI_DOCKER_RUN_EXTRA_ARGS="--entrypoint pwsh.exe -v ${pwd}:D: -w D:/" >> $env:GITHUB_ENV + + - name: Build + shell: pwsh + if: needs.check_files.outputs.run_job == 'true' + run: | + . .github/workflows/scripts/common-utils.ps1 + CIDockerRun ` + ghcr.io/taichi-dev/taichidev-cpu-windows:v0.0.2 ` + .github/workflows/scripts/win_build.ps1 -llvmVer ${{ matrix.llvmVer }} -libsDir X:/ + env: + TAICHI_CMAKE_ARGS: >- + -DTI_WITH_OPENGL:BOOL=OFF + -DTI_WITH_CC:BOOL=OFF + -DTI_WITH_VULKAN:BOOL=OFF + -DTI_WITH_CUDA:BOOL=OFF + -DTI_BUILD_TESTS:BOOL=OFF + -DTI_WITH_DX12:BOOL=ON + + - name: Test + shell: pwsh + if: needs.check_files.outputs.run_job == 'true' + run: | + . .github/workflows/scripts/common-utils.ps1 + CIDockerRun ` + ghcr.io/taichi-dev/taichidev-cpu-windows:v0.0.2 ` + .github/workflows/scripts/win_test.ps1 -libsDir X:/ + env: + TI_WANTED_ARCHS: cpu + + - name: Save wheel if test failed + if: failure() && steps.build_and_test.conclusion == 'failure' + uses: actions/upload-artifact@v3 + with: + name: broken-wheel + path: dist/* + retention-days: 7 + build_and_test_gpu_linux: name: Build and Test (GPU) needs: check_files @@ -303,3 +538,99 @@ jobs: name: bad-captures path: taichi-release-tests/bad-compare/* retention-days: 7 + + build_android_demos: + name: Build Android Demos + # Skip this job when testing the offline cache + if: ${{ github.event.schedule != '0 18 * * *' }} + needs: check_files + runs-on: [self-hosted, Linux, cn] + timeout-minutes: 60 + permissions: + packages: read + contents: read + env: + REDIS_HOST: 172.16.5.8 + PY: py39 + steps: + - uses: actions/checkout@v3 + name: Checkout taichi + with: + fetch-depth: '0' + submodules: "recursive" + + - name: Prepare Environment + run: >- + . .github/workflows/scripts/common-utils.sh; + prepare-build-cache; + + TAICHI_WHEEL_DIR=$(mktemp -d); + echo TAICHI_WHEEL_DIR=$TAICHI_WHEEL_DIR >> $GITHUB_ENV; + chmod 0777 $TAICHI_WHEEL_DIR; + + echo CI_DOCKER_RUN_EXTRA_ARGS=" + -e REDIS_HOST + -v $(pwd):/home/dev/taichi + -v $TAICHI_WHEEL_DIR:/taichi-wheel + " >> $GITHUB_ENV; + + - name: Build Host Taichi + run: | + . .github/workflows/scripts/common-utils.sh + ci-docker-run --name taichi-build-host \ + -v $TAICHI_WHEEL_DIR:/home/dev/taichi/dist \ + registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.4 \ + /home/dev/taichi/.github/workflows/scripts/unix-build.sh + env: + TAICHI_CMAKE_ARGS: >- + -DTI_WITH_OPENGL:BOOL=ON + -DTI_WITH_CC:BOOL=OFF + -DTI_WITH_VULKAN:BOOL=ON + -DTI_WITH_C_API=OFF + + - name: Build For Android + run: | + . .github/workflows/scripts/common-utils.sh + git clean -fxd + chown -R 1000:1000 . + ci-docker-run --name taichi-build-android \ + registry.taichigraphics.com/taichidev-androidsdk18.04:v0.0.6 \ + /home/dev/taichi/.github/workflows/scripts/android-build.sh + env: + TAICHI_CMAKE_ARGS: >- + -DTI_WITH_OPENGL:BOOL=ON + -DTI_WITH_CC:BOOL=OFF + -DTI_WITH_VULKAN:BOOL=ON + -DTI_WITH_LLVM:BOOL=OFF + -DTI_WITH_C_API=ON + + - name: Test For Android AOT (export core) + run: | + . .github/workflows/scripts/common-utils.sh + chown -R 1000:1000 . + ci-docker-run-gpu --name taichi-test-android \ + registry.taichigraphics.com/taichidev-androidsdk18.04:v0.0.6 \ + /home/dev/taichi/.github/workflows/scripts/aot-demo.sh build-and-smoke-test-android-aot-demo + + - name: Prepare Unity Build Environment + run: | + . .github/workflows/scripts/common-utils.sh + chown -R 1000:1000 . + ci-docker-run \ + registry.taichigraphics.com/taichidev-androidsdk18.04:v0.0.6 \ + /home/dev/taichi/.github/workflows/scripts/aot-demo.sh prepare-unity-build-env + + - name: Build Taichi-UnityExample + run: | + . .github/workflows/scripts/common-utils.sh + ci-docker-run \ + registry.taichigraphics.com/unityci-editor:ubuntu-2020.3.14f1-android-1-with-secret-sauce \ + /home/dev/taichi/.github/workflows/scripts/aot-demo.sh build-unity-demo + + - name: Run Taichi-UnityExample (C-API) + run: | + . .github/workflows/scripts/common-utils.sh + chown -R 1000:1000 . + ci-docker-run \ + registry.taichigraphics.com/taichidev-androidsdk18.04:v0.0.6 \ + /home/dev/taichi/.github/workflows/scripts/aot-demo.sh smoke-test-unity-demo