From 61d33a6e58f53968eec42d457531dce1a7be7dfb Mon Sep 17 00:00:00 2001 From: Vladimir Milosevic Date: Thu, 17 Oct 2024 14:30:25 +0000 Subject: [PATCH 1/2] Add workflow to auto create uplift PR --- .github/workflows/nightly-uplift.yml | 64 ++++++++++++++++++++++++++++ third_party/CMakeLists.txt | 4 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nightly-uplift.yml diff --git a/.github/workflows/nightly-uplift.yml b/.github/workflows/nightly-uplift.yml new file mode 100644 index 000000000..99f261008 --- /dev/null +++ b/.github/workflows/nightly-uplift.yml @@ -0,0 +1,64 @@ +# This workflow automates creation of uplift pull requests. +# Uplift PR is created daily to uplift the submodule to the latest version. + +name: Nighty Uplift + +on: + schedule: + - cron: '0 8 * * *' # Runs at 08:00 UTC every day + workflow_dispatch: # Manual trigger + +jobs: + uplift-pr: + runs-on: ubuntu-latest + + env: + SUBMODULE_PATH: third_party/tt-metal + TT_METAL_VERSION: origin/main + + steps: + + - uses: actions/checkout@v4 + + - name: Set env variable + run: | + echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + + - name: Update tt-metal reference + env: + GH_TOKEN: ${{ github.token }} + run: | + # Fetch the latest SHA using GitHub CLI + LATEST_SHA=$(gh api repos/tenstorrent/tt-metal/commits/main --jq '.sha') + # Update the third_party/CMakeLists.txt file with the new SHA + sed -i "s/set(TT_METAL_VERSION \".*\")/set(TT_METAL_VERSION \"${LATEST_SHA}\")/" third_party/CMakeLists.txt + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + id: create-pr + with: + branch: uplift + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> + base: main + commit-message: "Uplift ${{ env.SUBMODULE_PATH }} to ${{ env.SUBMODULE_VERSION }} ${{ env.TODAY }}" + title: "Uplift ${{ env.SUBMODULE_PATH }} to ${{ env.SUBMODULE_VERSION }} ${{ env.TODAY }}" + body: "This PR uplifts the ${{ env.SUBMODULE_PATH }} to the ${{ env.SUBMODULE_VERSION }}" + labels: uplift + delete-branch: true + token: ${{ secrets.GH_TOKEN }} + + - name: Approve Pull Request + if: ${{ steps.create-pr.outputs.pull-request-number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_APPROVE_TOKEN }} + run: | + echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}" + gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve + + - name: Enable Pull Request Automerge + if: ${{ steps.create-pr.outputs.pull-request-number }} + run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}" + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index db76b4a0e..20dc8cb65 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -1,5 +1,7 @@ include(ExternalProject) +set(TT_METAL_VERSION "047cdd97fa26b229208ce2f6f8b149c3df277be0") + if ("$ENV{ARCH_NAME}" STREQUAL "grayskull") set(ARCH_NAME "grayskull") set(ARCH_EXTRA_DIR "grayskull") @@ -56,7 +58,7 @@ ExternalProject_Add( -DENABLE_TRACY=${TT_RUNTIME_ENABLE_PERF_TRACE} -DENABLE_LIBCXX=OFF GIT_REPOSITORY https://github.com/tenstorrent/tt-metal.git - GIT_TAG 047cdd97fa26b229208ce2f6f8b149c3df277be0 + GIT_TAG ${TT_METAL_VERSION} GIT_PROGRESS ON BUILD_BYPRODUCTS ${TTNN_LIBRARY_PATH} ${TTMETAL_LIBRARY_PATH} ${TRACY_LIBRARY_PATH} ) From 424d81115a9cb08afeb3da6c86c7aaa1632e0fe3 Mon Sep 17 00:00:00 2001 From: Vladimir Milosevic Date: Thu, 17 Oct 2024 14:45:28 +0000 Subject: [PATCH 2/2] Fix pre-commit checks --- .github/workflows/nightly-uplift.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nightly-uplift.yml b/.github/workflows/nightly-uplift.yml index 99f261008..a0f6eb534 100644 --- a/.github/workflows/nightly-uplift.yml +++ b/.github/workflows/nightly-uplift.yml @@ -8,8 +8,8 @@ on: - cron: '0 8 * * *' # Runs at 08:00 UTC every day workflow_dispatch: # Manual trigger -jobs: - uplift-pr: +jobs: + uplift-pr: runs-on: ubuntu-latest env: @@ -28,9 +28,9 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - # Fetch the latest SHA using GitHub CLI + # Fetch the latest SHA using GitHub CLI LATEST_SHA=$(gh api repos/tenstorrent/tt-metal/commits/main --jq '.sha') - # Update the third_party/CMakeLists.txt file with the new SHA + # Update the third_party/CMakeLists.txt file with the new SHA sed -i "s/set(TT_METAL_VERSION \".*\")/set(TT_METAL_VERSION \"${LATEST_SHA}\")/" third_party/CMakeLists.txt - name: Create Pull Request @@ -43,20 +43,20 @@ jobs: base: main commit-message: "Uplift ${{ env.SUBMODULE_PATH }} to ${{ env.SUBMODULE_VERSION }} ${{ env.TODAY }}" title: "Uplift ${{ env.SUBMODULE_PATH }} to ${{ env.SUBMODULE_VERSION }} ${{ env.TODAY }}" - body: "This PR uplifts the ${{ env.SUBMODULE_PATH }} to the ${{ env.SUBMODULE_VERSION }}" + body: "This PR uplifts the ${{ env.SUBMODULE_PATH }} to the ${{ env.SUBMODULE_VERSION }}" labels: uplift delete-branch: true token: ${{ secrets.GH_TOKEN }} - + - name: Approve Pull Request if: ${{ steps.create-pr.outputs.pull-request-number }} env: GITHUB_TOKEN: ${{ secrets.GH_APPROVE_TOKEN }} run: | echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}" - gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve - + echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}" + gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve + - name: Enable Pull Request Automerge if: ${{ steps.create-pr.outputs.pull-request-number }} run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}"