From aec4f9983f1813594106aad6105125ff6b39e425 Mon Sep 17 00:00:00 2001 From: Proton Date: Fri, 6 Jan 2023 14:16:47 +0800 Subject: [PATCH] Revert "remove real testing" This reverts commit a9e6506ce97fb79ae1eaf6c6a26299d16d18e2b1. --- .github/workflows/testing.yml | 563 +++++++++++++++++++++++++++++++++- 1 file changed, 548 insertions(+), 15 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 808e5b572b5b1..dbc4b0dc5fc3a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -17,26 +17,334 @@ env: TI_TEST_OFFLINE_CACHE: ${{ github.event.schedule == '0 18 * * *' && '1' || '' }} jobs: + show_environ: + name: Show Environment Variables + # Disable this workflow on forks + if: github.repository_owner == 'taichi-dev' + runs-on: [self-hosted, Linux] + steps: + - name: Environment Variables + run: env + - name: Github Object + run: | + cat <<'EOF' + ${{ toJson(github) }} + EOF + + check_files: + name: Check files + # Disable this workflow on forks + if: github.repository_owner == 'taichi-dev' + outputs: + run_job: ${{ steps.check_files.outputs.run_job }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: '0' + + - name: check modified files + id: check_files + run: | + echo "Concurrency group: ${{ github.event.number || github.run_id }}" + echo "=============== list modified files ===============" + git diff --name-only @^ + + chore_files=( LICENSE CONTRIBUTING.md README.md netlify.toml ) + chore_dirs=( docs ) + run_job=false + + for file in $(git diff --name-only @^); do + is_chore=false + + for chore_file in ${chore_files[*]}; do + [[ ${file} == ${chore_file} ]] && is_chore=true && break + done + + for chore_dir in ${chore_dirs[*]}; do + [[ ${file} == ${chore_dir}/* ]] && is_chore=true && break + done + + if ! ${is_chore}; then + run_job=true + break + fi + done + + if ${run_job}; then + echo "run_job=true" >> $GITHUB_OUTPUT + else + echo "run_job=false" >> $GITHUB_OUTPUT + fi + + check_static_analyzer: + name: Check Static Analyzer + runs-on: ubuntu-latest + needs: check_files + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: '0' + + - name: clang-tidy + run: | + if [[ ${{needs.check_files.outputs.run_job}} == false ]]; then + exit 0 + fi + # 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 + echo $CR_PAT | docker login ghcr.io -u ${{ github.actor }} --password-stdin + docker pull ghcr.io/taichi-dev/taichidev-cpu-ubuntu18.04:v0.3.3 + docker run -id --user dev --name check_clang_tidy ghcr.io/taichi-dev/taichidev-cpu-ubuntu18.04:v0.3.3 /bin/bash + tar -cf - ../${{ github.event.repository.name }} --mode u=+rwx,g=+rwx,o=+rwx --owner 1000 --group 1000 | docker cp - check_clang_tidy:/home/dev/ + docker exec --user root check_clang_tidy apt-get update + docker exec --user root check_clang_tidy apt install -y clang-tidy-10 libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev zlib1g-dev libglew-dev libglfw3-dev + docker exec --user dev check_clang_tidy /home/dev/taichi/.github/workflows/scripts/check_clang_tidy.sh "$CI_SETUP_CMAKE_ARGS" + env: + CR_PAT: ${{ secrets.GITHUB_TOKEN }} + CI_SETUP_CMAKE_ARGS: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON -DTI_WITH_BACKTRACE:BOOL=ON + + build_and_test_cpu_mac: + name: Build and Test macos (CPU) + needs: check_files + timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 120 || 180 }} + 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 + env: + CI_PLATFORM: macos + + - name: Build & Install + if: needs.check_files.outputs.run_job == 'true' + run: | + # Use the molten-vk v1.1.10 downloaded from taichi assets + brew uninstall molten-vk -f + .github/workflows/scripts/build.py + 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_WITH_BACKTRACE:BOOL=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_gpu_linux: + name: Build and Test (GPU) + needs: check_files + timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 90 || 120 }} + strategy: + matrix: + tags: + - [self-hosted, cuda, vulkan, cn, driver470] + - [self-hosted, cuda, vulkan, cn, driver510] + + runs-on: ${{ matrix.tags }} + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: '0' + + - 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 & Install + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + . .github/workflows/scripts/common-utils.sh + + ci-docker-run-gpu --name taichi-build \ + registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.4 \ + /home/dev/taichi/.github/workflows/scripts/build.py + + env: + PY: '3.8' + PROJECT_NAME: taichi + TAICHI_CMAKE_ARGS: >- + -DTI_WITH_OPENGL:BOOL=ON + -DTI_WITH_CC:BOOL=ON + -DTI_WITH_VULKAN:BOOL=ON + -DTI_WITH_BACKTRACE:BOOL=ON + -DTI_BUILD_TESTS:BOOL=ON + -DTI_WITH_C_API=ON + + - name: Check C-API Export Symbols + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + . .github/workflows/scripts/common-utils.sh + + ci-docker-run-gpu --name taichi-test-check-c-api-export-symbols \ + registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.4 \ + /home/dev/taichi/.github/workflows/scripts/aot-demo.sh check-c-api-export-symbols + + - name: Test + id: test + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + . .github/workflows/scripts/common-utils.sh + + ci-docker-run-gpu --name taichi-test \ + registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.4 \ + /home/dev/taichi/.github/workflows/scripts/unix_test.sh + env: + PY: '3.8' + TI_WANTED_ARCHS: 'cc,cpu,cuda,vulkan,opengl' + TI_DEVICE_MEMORY_GB: '1' + TI_RUN_RELEASE_TESTS: '1' + + - name: Build & Run C-API Headless Demos (Desktop) + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + . .github/workflows/scripts/common-utils.sh + chown -R 1000:1000 . + ci-docker-run-gpu --name taichi-test-capi-headless-demo-desktop \ + registry.taichigraphics.com/taichidev-ubuntu18.04:v0.3.4 \ + /home/dev/taichi/.github/workflows/scripts/aot-demo.sh build-and-test-headless-demo-desktop + env: + PY: '3.8' + TI_DEVICE_MEMORY_GB: '0.1' + + - 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: Save Bad Captures + if: failure() && steps.test.conclusion == 'failure' + uses: actions/upload-artifact@v3 + with: + name: bad-captures + path: taichi-release-tests/bad-compare/* + retention-days: 7 + + build_and_test_amdgpu_linux: + name: Build and Test (AMDGPU) + needs: check_files + timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 90 || 120 }} + runs-on: [self-hosted, amdgpu] + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: '0' + + - 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 & Install + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + . .github/workflows/scripts/common-utils.sh + + ci-docker-run-amdgpu --name taichi-build \ + registry.taichigraphics.com/taichidev-ubuntu18.04.amdgpu:v0.0.5 \ + /home/dev/taichi/.github/workflows/scripts/build.py + + env: + PY: '3.8' + PROJECT_NAME: taichi + TAICHI_CMAKE_ARGS: >- + -DTI_WITH_CUDA:BOOL=OFF + -DTI_WITH_VULKAN:BOOL=OFF + -DTI_WITH_OPENGL:BOOL=OFF + -DTI_BUILD_TESTS:BOOL=ON + -DTI_WITH_AMDGPU:BOOL=ON + + - name: Test + id: test + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + . .github/workflows/scripts/common-utils.sh + + ci-docker-run-amdgpu --name taichi-test \ + registry.taichigraphics.com/taichidev-ubuntu18.04.amdgpu:v0.0.5 \ + /home/dev/taichi/.github/workflows/scripts/unix_test.sh + env: + PY: '3.8' + TI_WANTED_ARCHS: 'cpu,amdgpu' + TI_DEVICE_MEMORY_GB: '1' + TI_RUN_RELEASE_TESTS: '0' + + - 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: Save Bad Captures + if: failure() && steps.test.conclusion == 'failure' + uses: actions/upload-artifact@v3 + with: + name: bad-captures + path: taichi-release-tests/bad-compare/* + retention-days: 7 + + build_and_test_windows: name: Build and Test Windows + needs: check_files strategy: matrix: include: - - foo: 1 - runsOn: [self-hosted, windows, cuda, OpenGL] - - foo: 2 - runsOn: [self-hosted, windows, cuda, OpenGL] - - foo: 3 - runsOn: [self-hosted, windows, cuda, OpenGL] - - foo: 4 - runsOn: [self-hosted, windows, cuda, OpenGL] - - foo: 5 - runsOn: [self-hosted, windows, cuda, OpenGL] - - foo: 6 - runsOn: [self-hosted, windows, cuda, OpenGL] - - foo: 7 - runsOn: [self-hosted, windows, cuda, OpenGL] - - foo: 8 + - os: windows-2019 + llvmVer : '15' + archs: "cpu,cuda,opengl" runsOn: [self-hosted, windows, cuda, OpenGL] runs-on: ${{ matrix.runsOn }} timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 90 || 180 }} @@ -53,3 +361,228 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.7 + + - name: Build + shell: pwsh + if: ${{ needs.check_files.outputs.run_job != 'false' }} + run: | + .\.github\workflows\scripts\win_build.ps1 -llvmVer ${{ matrix.llvmVer }} -installVulkan -libsDir "$env:LocalAppData/buildbot" + env: + PY: "3.7" + TAICHI_CMAKE_ARGS: >- + -DTI_WITH_OPENGL:BOOL=ON + -DTI_WITH_DX11:BOOL=ON + -DTI_WITH_DX12:BOOL=ON + -DTI_WITH_CC:BOOL=OFF + -DTI_BUILD_TESTS:BOOL=ON + -DTI_WITH_BACKTRACE=ON + -DTI_WITH_C_API=ON + + - name: Test + id: test + shell: pwsh + if: ${{ needs.check_files.outputs.run_job != 'false' }} + run: | + .\.github\workflows\scripts\win_test.ps1 -libsDir "$env:LocalAppData/buildbot" + env: + PY: "3.7" + TI_WANTED_ARCHS: ${{ matrix.archs }} + TI_SKIP_VERSION_CHECK: ON + TI_DEVICE_MEMORY_GB: '1' + TI_RUN_RELEASE_TESTS: '1' + + - 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_m1: + name: Build and Test (Apple M1) + needs: check_files + timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 60 || 120 }} + strategy: + matrix: + include: + - os: macos-latest + python: 3.8 + defaults: + run: + # https://github.com/actions/runner/issues/805#issuecomment-844426478 + shell: '/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}' + runs-on: [self-hosted, m1] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: '0' + submodules: 'recursive' + + - name: Build + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + . .github/workflows/scripts/common-utils.sh + prepare-build-cache + brew install molten-vk + brew install llvm@15 + .github/workflows/scripts/build.py + env: + 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 + -DTI_WITH_BACKTRACE:BOOL=ON + -DTI_WITH_C_API=ON + + - name: Check C-API Export Symbols + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + . .github/workflows/scripts/common-utils.sh + + .github/workflows/scripts/aot-demo.sh check-c-api-export-symbols + + - name: Test + id: test + run: | + [[ ${{needs.check_files.outputs.run_job}} == false ]] && exit 0 + .github/workflows/scripts/unix_test.sh + env: + TI_WANTED_ARCHS: 'cpu,metal,vulkan' + PY: ${{ matrix.python }} + PLATFORM: 'm1' + TI_RUN_RELEASE_TESTS: '1' + + - 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: Save Bad Captures + if: failure() && steps.test.conclusion == 'failure' + uses: actions/upload-artifact@v3 + with: + 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: '3.9' + steps: + - uses: actions/checkout@v3 + name: Checkout taichi + with: + fetch-depth: '0' + submodules: "recursive" + + - name: Prepare Environment + if: ${{ needs.check_files.outputs.run_job != 'false' }} + 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 + if: ${{ needs.check_files.outputs.run_job != 'false' }} + 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/build.py + 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 + if: ${{ needs.check_files.outputs.run_job != 'false' }} + 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 + if: ${{ needs.check_files.outputs.run_job != 'false' }} + 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 + if: ${{ needs.check_files.outputs.run_job != 'false' }} + run: | + . .github/workflows/scripts/common-utils.sh + chown -R 1000:1000 . + ci-docker-run --name taichi-prepare-unity-build-env \ + 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 + if: ${{ needs.check_files.outputs.run_job != 'false' }} + run: | + . .github/workflows/scripts/common-utils.sh + ci-docker-run --name taichi-build-unity-demo \ + 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) + if: ${{ needs.check_files.outputs.run_job != 'false' }} + run: | + . .github/workflows/scripts/common-utils.sh + chown -R 1000:1000 . + ci-docker-run --name taichi-run-unity-demo \ + registry.taichigraphics.com/taichidev-androidsdk18.04:v0.0.6 \ + /home/dev/taichi/.github/workflows/scripts/aot-demo.sh smoke-test-unity-demo + + - name: Build & Run C-API Headless Demos (Android) + if: ${{ needs.check_files.outputs.run_job != 'false' }} + run: | + . .github/workflows/scripts/common-utils.sh + chown -R 1000:1000 . + ci-docker-run-gpu --name taichi-test-capi-headless-demo \ + registry.taichigraphics.com/taichidev-androidsdk18.04:v0.0.6 \ + /home/dev/taichi/.github/workflows/scripts/aot-demo.sh build-and-test-headless-demo + env: + TI_DEVICE_MEMORY_GB: '0.1'