Skip to content

Commit

Permalink
Added gh workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kmitrovicTT committed Nov 15, 2024
1 parent 57a5a37 commit 4e8589b
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 15 deletions.
20 changes: 20 additions & 0 deletions .github/on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: On PR

on:
workflow_dispatch:
pull_request:
branches: [ "main" ]

jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yml
secrets: inherit

spdx:
uses: ./.github/workflows/spdx.yml
secrets: inherit

build-and-test:
needs: [pre-commit, spdx]
uses: ./.github/workflows/build-and-test.yml
secrets: inherit
28 changes: 15 additions & 13 deletions .github/workflows/nightly-uplift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,31 @@ jobs:
runs-on: ubuntu-latest

env:
SUBMODULE_PATH: third_party/tt-mlir
MLIR_VERSION: origin/main
TT_MLIR_SUBMODULE_PATH: third_party/tt-mlir

steps:

- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Fetch all history and tags
fetch-depth: 0
ref: main

- name: Set env variable
- name: Set env variable for today's date
run: |
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Update tt-mlir reference
- name: Fetch latest SHA of tt-mlir submodule
id: get_sha
run: |
LATEST_TT_MLIR_VERSION=$(gh api repos/tenstorrent/tt-mlir/commits/main --jq '.sha')
echo "LATEST_TT_MLIR_VERSION=$LATEST_TT_MLIR_VERSION" >> $GITHUB_ENV
- name: Update tt-mlir reference in third_party/CMakeLists.txt
env:
GH_TOKEN: ${{ github.token }}
run: |
# Fetch the latest SHA using GitHub CLI
LATEST_SHA=$(gh api repos/tenstorrent/tt-mlir/commits/main --jq '.sha')
# Update the CMakeLists.txt file with the new SHA
sed -i "s/set(TT_MLIR_VERSION \".*\")/set(TT_MLIR_VERSION \"${LATEST_SHA}\")/" third_party/CMakeLists.txt
echo "Updating tt-mlir to SHA: $LATEST_TT_MLIR_VERSION"
sed -i "s/set(TT_MLIR_VERSION \".*\")/set(TT_MLIR_VERSION \"${LATEST_TT_MLIR_VERSION}\")/" third_party/CMakeLists.txt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
Expand All @@ -45,9 +47,9 @@ jobs:
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 }}"
commit-message: "Uplift ${{ env.TT_MLIR_SUBMODULE_PATH }} to ${{ env.LATEST_TT_MLIR_VERSION }} ${{ env.TODAY }}"
title: "Uplift ${{ env.TT_MLIR_SUBMODULE_PATH }} to ${{ env.LATEST_TT_MLIR_VERSION }} ${{ env.TODAY }}"
body: "This PR uplifts the ${{ env.TT_MLIR_SUBMODULE_PATH }} to the ${{ env.LATEST_TT_MLIR_VERSION }}"
labels: uplift
delete-branch: true
token: ${{ secrets.GH_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ on:
branches: [ "main" ]

jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yml
secrets: inherit
spdx:
uses: ./.github/workflows/spdx.yml
secrets: inherit
build-and-test:
needs: [pre-commit, spdx]
uses: ./.github/workflows/build-and-test.yml
secrets: inherit
20 changes: 20 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: On push

on:
workflow_dispatch:
push:
branches: [ "main" ]

jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yml
secrets: inherit

spdx:
uses: ./.github/workflows/spdx.yml
secrets: inherit

build-and-test:
needs: [pre-commit, spdx]
uses: ./.github/workflows/build-and-test.yml
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: pre-commit

on:
workflow_dispatch:
workflow_call:

jobs:
pre-commit:

timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
pip install -r requirements.txt
- name: Install pre-commit hooks
run: |
pre-commit install
- name: Run pre-commit
uses: pre-commit/[email protected]
2 changes: 0 additions & 2 deletions tests/TTIR/test_conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
(1, 256, 64, 56, 56, 1, 1, 2, 2, 0),
),
)

@pytest.mark.skip("AssertionError.")
def test_conv2d(
batch_size,
Expand All @@ -55,7 +54,6 @@ def test_conv2d(
stride_w,
padding,
):

def module_conv(img, weights):
return jax.lax.conv_general_dilated(
img,
Expand Down

0 comments on commit 4e8589b

Please sign in to comment.