diff --git a/.github/workflows/tgg-unit-tests-impl.yaml b/.github/workflows/tgg-unit-tests-impl.yaml index 140230c82b2..22a56b63189 100644 --- a/.github/workflows/tgg-unit-tests-impl.yaml +++ b/.github/workflows/tgg-unit-tests-impl.yaml @@ -2,6 +2,13 @@ name: "[internal] TGG unit tests impl" on: workflow_call: + inputs: + docker-image: + required: true + type: string + wheel-artifact-name: + required: true + type: string jobs: TGG-tests: @@ -17,26 +24,60 @@ jobs: }, ] name: ${{ matrix.test-group.name }} - env: - ARCH_NAME: ${{ matrix.test-group.arch }} - LOGURU_LEVEL: INFO - LD_LIBRARY_PATH: ${{ github.workspace }}/build/lib runs-on: ${{ matrix.test-group.runs-on }} + container: + image: ${{ inputs.docker-image }} + env: + TT_METAL_HOME: /work + PYTHONPATH: /work + LD_LIBRARY_PATH: /work/build/lib + LOGURU_LEVEL: INFO + ARCH_NAME: ${{ matrix.test-group.arch }} + volumes: + - ${{ github.workspace }}/docker-job:/work # Subdir to workaround https://github.com/actions/runner/issues/691 + - /dev/hugepages-1G:/dev/hugepages-1G + - /mnt/MLPerf:/mnt/MLPerf + options: "--device /dev/tenstorrent" + defaults: + run: + shell: bash + working-directory: /work # https://github.com/actions/runner/issues/878 steps: - - uses: tenstorrent/tt-metal/.github/actions/checkout-with-submodule-lfs@main - - name: Set up dynamic env vars for build - run: | - echo "TT_METAL_HOME=$(pwd)" >> $GITHUB_ENV + - name: ⬇️ Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + path: docker-job # Here be dragons; keep it scoped to our desired volume, yet must be under github.workspace and be sure to clean up at the end - uses: actions/download-artifact@v4 with: name: TTMetal_build_any + path: /work - name: Extract files run: tar -xvf ttm_any.tar - - uses: ./.github/actions/install-python-deps + - name: ⬇️ Download Wheel + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.wheel-artifact-name }} + path: /work + - name: Install Wheel + run: | + WHEEL_FILENAME=$(ls -1 *.whl) + pip3 install $WHEEL_FILENAME - name: Run unit regression tests timeout-minutes: 60 run: | - source ${{ github.workspace }}/python_env/bin/activate - cd $TT_METAL_HOME - export PYTHONPATH=$TT_METAL_HOME + set -x + pwd + echo $PYTHONPATH + ls -al ${{ matrix.test-group.cmd }} + - name: Cleanup + if: always() + run: | + # We are forced to checkout the repo into a subdir of the host's workdir; this pollutes the host + # with root-owned files. Be sure to clean up after ourselves in case we're on a non-ephemeral runner. + echo "pre rm" + ls -al /__w/tt-metal/tt-metal + rm -rf /__w/tt-metal/tt-metal/docker-job + echo "post rm" + ls -al /__w/tt-metal/tt-metal diff --git a/.github/workflows/tgg-unit-tests.yaml b/.github/workflows/tgg-unit-tests.yaml index 6c42ff61f4f..9d1bba42a64 100644 --- a/.github/workflows/tgg-unit-tests.yaml +++ b/.github/workflows/tgg-unit-tests.yaml @@ -9,7 +9,12 @@ jobs: build-artifact: uses: ./.github/workflows/build-artifact.yaml secrets: inherit + with: + build-wheel: true TGG-tests: needs: build-artifact secrets: inherit uses: ./.github/workflows/tgg-unit-tests-impl.yaml + with: + docker-image: ${{ needs.build-artifact.outputs.ci-build-docker-image }} + wheel-artifact-name: ${{ needs.build-artifact.outputs.wheel-artifact-name }} diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh index 0f4d4480a11..a048cd440c5 100755 --- a/tests/scripts/run_tests.sh +++ b/tests/scripts/run_tests.sh @@ -431,7 +431,13 @@ set_up_chdir() { return fi done - echo "Could not find the 'tt-metal' directory in your PYTHONPATH." 1>&2 + for ENTRY in "${ENTRIES[@]}"; do + if [[ -d "$ENTRY/tt_metal" ]]; then + cd "$ENTRY" + return + fi + done + echo "Could not find the 'tt-metal' directory in your PYTHONPATH." 1>&2 exit 1 }