diff --git a/.github/workflows/build-device.yml b/.github/workflows/build-device.yml new file mode 100644 index 00000000..d88c0630 --- /dev/null +++ b/.github/workflows/build-device.yml @@ -0,0 +1,53 @@ +# Builds umd_device. +# Build is performed on all supported OS versions. +name: Build Target + +on: + workflow_call: + inputs: + timeout: + required: true + type: number + workflow_dispatch: + inputs: + timeout: + required: true + description: 'The timeout for the build job in minutes' + type: number + +env: + BUILD_TARGET: umd_device + BUILD_OUTPUT_DIR: ./build + LIB_OUTPUT_DIR: ./build/lib + DEPS_OUTPUT_DIR: ./build/_deps + TEST_OUTPUT_DIR: ./build/test + CREATE_MAP_BINARIES_DIR: ./device/bin/silicon + +jobs: + build: + timeout-minutes: ${{ inputs.timeout }} + strategy: + fail-fast: false + matrix: + build: [ + {runs-on: ubuntu-22.04, docker-image: tt-umd-ci-ubuntu-22.04}, + {runs-on: ubuntu-20.04, docker-image: tt-umd-ci-ubuntu-20.04}, + ] + + name: Build umd_device for any arch on ${{ matrix.build.runs-on }} + runs-on: ${{ matrix.build.runs-on }} + container: + image: ghcr.io/${{ github.repository }}/${{ matrix.build.docker-image }}:latest + options: --user root + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build ${{ env.BUILD_TARGET }} + run: | + echo "Compiling the code..." + cmake -B ${{ env.BUILD_OUTPUT_DIR }} -G Ninja + cmake --build ${{ env.BUILD_OUTPUT_DIR }} --target ${{ env.BUILD_TARGET }} + echo "Compile complete." diff --git a/.github/workflows/build-target.yml b/.github/workflows/build-tests.yml similarity index 71% rename from .github/workflows/build-target.yml rename to .github/workflows/build-tests.yml index 9b158d38..e609b837 100644 --- a/.github/workflows/build-target.yml +++ b/.github/workflows/build-tests.yml @@ -1,4 +1,4 @@ -# Builds requested target and uploads its artifact if requested. +# Builds umd_tests. # Build is performed on the specified architecture and on all supported OS versions. name: Build Target @@ -11,13 +11,6 @@ on: timeout: required: true type: number - build-target: - required: true - type: string - upload-artifacts: - required: false - type: boolean - default: false workflow_dispatch: inputs: arch: @@ -32,21 +25,10 @@ on: required: true description: 'The timeout for the build job in minutes' type: number - build-target: - required: true - description: 'The target to build' - type: choice - options: - - umd_device - - umd_tests - upload-artifacts: - required: false - description: 'Whether to upload artifacts' - type: boolean - default: false env: + BUILD_TARGET: umd_tests BUILD_OUTPUT_DIR: ./build LIB_OUTPUT_DIR: ./build/lib DEPS_OUTPUT_DIR: ./build/_deps @@ -64,7 +46,7 @@ jobs: {runs-on: ubuntu-20.04, docker-image: tt-umd-ci-ubuntu-20.04}, ] - name: Build ${{ inputs.build-target }} for ${{ inputs.arch }} on ${{ matrix.build.runs-on }} + name: Build umd_tests for ${{ inputs.arch }} on ${{ matrix.build.runs-on }} runs-on: ${{ matrix.build.runs-on }} container: image: ghcr.io/${{ github.repository }}/${{ matrix.build.docker-image }}:latest @@ -78,22 +60,20 @@ jobs: with: submodules: recursive - - name: Build ${{ inputs.build-target }} + - name: Build ${{ env.BUILD_TARGET }} run: | echo "Compiling the code..." cmake -B ${{ env.BUILD_OUTPUT_DIR }} -G Ninja -DTT_UMD_BUILD_TESTS=ON - cmake --build ${{ env.BUILD_OUTPUT_DIR }} --target ${{ inputs.build-target }} + cmake --build ${{ env.BUILD_OUTPUT_DIR }} --target ${{ env.BUILD_TARGET }} echo "Compile complete." # This is needed to preserve file permissions # https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss - name: Tar build, test and run artifacts - if: ${{ inputs.upload-artifacts }} shell: bash run: tar cvf artifact.tar ${{ env.TEST_OUTPUT_DIR }} ${{ env.LIB_OUTPUT_DIR }} ${{ env.DEPS_OUTPUT_DIR }} ${{ env.CREATE_MAP_BINARIES_DIR }} - name: Upload build artifacts archive - if: ${{ inputs.upload-artifacts }} uses: actions/upload-artifact@v4 with: name: build-artifacts-${{ inputs.arch }}-${{ matrix.build.runs-on }} diff --git a/.github/workflows/on-pr-opt.yml b/.github/workflows/on-pr-opt.yml index 97033310..c15694da 100644 --- a/.github/workflows/on-pr-opt.yml +++ b/.github/workflows/on-pr-opt.yml @@ -18,12 +18,10 @@ jobs: { arch: wormhole_b0 }, # { arch: blackhole }, ] - uses: ./.github/workflows/build-target.yml + uses: ./.github/workflows/build-tests.yml with: arch: ${{ matrix.test-group.arch }} timeout: 10 - build-target: umd_tests - upload-artifacts: true test-all: secrets: inherit diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 0a4808e9..85a39fb4 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -9,16 +9,6 @@ on: jobs: build-all: secrets: inherit - strategy: - fail-fast: false - matrix: - test-group: [ - { arch: grayskull }, - { arch: wormhole_b0 }, - { arch: blackhole }, - ] - uses: ./.github/workflows/build-target.yml + uses: ./.github/workflows/build-device.yml with: - arch: ${{ matrix.test-group.arch }} - timeout: 10 - build-target: umd_device \ No newline at end of file + timeout: 10 \ No newline at end of file diff --git a/README.md b/README.md index e6bb5103..52e4f4fe 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ sudo apt install -y libhwloc-dev ## Build flow We are transitioning away from Make. The main libraries and tests should now be built with CMake. -Specify the `ARCH_NAME` environment variable as `grayskull` or `wormhole_b0` before building. +The device lib is built once for all supported architectures (grayskull, wormhole and blackhole). To build `libdevice.so`: ``` @@ -18,8 +18,12 @@ ninja -C build ninja umd_device -C build ``` +Tests are build separatelly for each architecture. +Specify the `ARCH_NAME` environment variable as `grayskull`, `wormhole_b0` or `blackhole` before building. +You also need to configure cmake to enable tests, hence the need to run cmake configuration step again. To build tests: ``` +cmake -B build -G Ninja -DTT_UMD_BUILD_TESTS=ON ninja umd_tests -C build ```