Skip to content

Commit

Permalink
Separate workflows for build and running tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
uazizTT committed Nov 5, 2024
1 parent 7706bad commit 7bad386
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 11 deletions.
8 changes: 6 additions & 2 deletions .github/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
spdx:
uses: ./.github/workflows/spdx.yml
secrets: inherit
build-and-test:
uses: ./.github/workflows/build-and-test.yml
build:
uses: ./.github/workflows/run-build.yml
secrets: inherit
test:
needs: build
uses: ./.github/workflows/run-tests.yml
secrets: inherit
8 changes: 6 additions & 2 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
spdx:
uses: ./.github/workflows/spdx.yml
secrets: inherit
build-and-test:
uses: ./.github/workflows/build-and-test.yml
build:
uses: ./.github/workflows/run-build.yml
secrets: inherit
test:
needs: build
uses: ./.github/workflows/run-tests.yml
secrets: inherit
8 changes: 6 additions & 2 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
spdx:
uses: ./.github/workflows/spdx.yml
secrets: inherit
build-and-test:
uses: ./.github/workflows/build-and-test.yml
build:
uses: ./.github/workflows/run-build.yml
secrets: inherit
test:
needs: build
uses: ./.github/workflows/run-tests.yml
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ jobs:
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}

- name: ccache
uses: hendrikmuhs/[email protected]
with:
Expand All @@ -134,6 +137,7 @@ jobs:
source env/activate
cmake -G Ninja \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.install-output-dir }} \
-B ${{ steps.strings.outputs.build-output-dir }} \
-S ${{ steps.strings.outputs.work-dir }}
Expand All @@ -144,9 +148,23 @@ jobs:
cmake --build ${{ steps.strings.outputs.build-output-dir }}
cmake --install ${{ steps.strings.outputs.build-output-dir }}
- name: Run tests
- name: Copy tt-metal binaries
shell: bash
run: |
export LD_LIBRARY_PATH="/opt/ttmlir-toolchain/lib/:${{ steps.strings.outputs.install-output-dir }}/lib:${LD_LIBRARY_PATH}"
source env/activate
pytest -v tests --ignore=tests/models
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: cp ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal-build/lib/*.so lib/

-name: Copy libfmt
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: cp ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal-build/_deps/fmt-build/*.so lib/

- name: 'Tar install directory'
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: tar cvf artifact.tar .

- name: Upload install folder to archive
uses: actions/upload-artifact@v4
with:
name: install-artifacts
path: ${{ steps.strings.outputs.install-output-dir }}/artifact.tar
70 changes: 70 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Test

on:
workflow_dispatch:
workflow_call:
workflow_run:
workflows: [Build]
types: [completed]

jobs:
tests:
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
build: [
{runs-on: n150, name: "run"},
]

runs-on:
- in-service
- ${{ matrix.build.runs-on }}

container:
image: ghcr.io/tenstorrent/tt-torch/tt-torch-ci-ubuntu-22-04:latest
options: --user root --device /dev/tenstorrent/0
volumes:
- /dev/hugepages:/dev/hugepages
- /dev/hugepages-1G:/dev/hugepages-1G
- /etc/udev/rules.d:/etc/udev/rules.d
- /lib/modules:/lib/modules
- /opt/tt_metal_infra/provisioning/provisioning_env:/opt/tt_metal_infra/provisioning/provisioning_env

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
lfs: true

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}

- name: Use build artifacts
uses: actions/download-artifact@v4
with:
name: install-artifacts
path: ${{ steps.strings.outputs.install-output-dir }}

- name: 'Untar install directory'
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: tar xvf artifact.tar

- name: Run tests
shell: bash
run: |
echo $pwd
echo ${{ steps.strings.outputs.install-output-dir }}
echo ${{ steps.strings.outputs.build-output-dir }}/
source env/activate
export LD_LIBRARY_PATH="/opt/ttmlir-toolchain/lib/:${{ steps.strings.outputs.install-output-dir }}/lib:${{ steps.strings.outputs.build-output-dir }}/lib:./lib/:${LD_LIBRARY_PATH}"
pytest -sv tests --ignore=tests/models

0 comments on commit 7bad386

Please sign in to comment.