Skip to content

Commit

Permalink
Add test grouping to workflow inputs (#1029)
Browse files Browse the repository at this point in the history
Add option to define test grouping as workflow input.
For example, this will run tests in 4 group
```
docker-build:
    uses: ./.github/workflows/build-and-test.yml
    secrets: inherit
    with:
      test_mark: 'nightly'
      test_group_cnt: 4
      test_group_ids: '[1,2,3,4]'
```
  • Loading branch information
vmilosevic authored Jan 14, 2025
1 parent 45a03b8 commit 8aebefb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ on:
description: 'Git SHA of commit in tenstorrent/tt-mlir or branch name'
required: false
type: string
test_group_cnt:
description: 'Test group count'
required: true
default: 2
type: number
test_group_ids:
description: 'Test group ids'
required: true
default: '[1,2]'
type: string
workflow_call:
inputs:
test_mark:
Expand All @@ -28,14 +38,23 @@ on:
description: 'Git SHA of commit in tenstorrent/tt-mlir or branch name'
required: false
type: string
test_group_cnt:
description: 'Test group count'
required: false
default: 2
type: number
test_group_ids:
description: 'Test group ids'
required: false
default: '[1,2]'
type: string

permissions:
packages: write
checks: write
pull-requests: write # only required if `comment: true` was enabled

jobs:

docker-build:
uses: ./.github/workflows/build-image.yml
secrets: inherit
Expand All @@ -48,7 +67,7 @@ jobs:
matrix:
build:
- runs-on: runner
test_group_id: [1,2]
test_group_id: ${{ fromJson(inputs.test_group_ids) }}

runs-on:
- in-service
Expand Down Expand Up @@ -152,7 +171,7 @@ jobs:
apt install -y libgl1 libglx-mesa0
set -o pipefail # Ensures that the exit code reflects the first command that fails
pip install pytest-split
pytest -m push --splits 2 \
pytest -m push --splits ${{ inputs.test_group_cnt }} \
--group ${{ matrix.test_group_id }} \
--splitting-algorithm least_duration \
-m "${{ inputs.test_mark }}" \
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/on-nightly-sweeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ jobs:
secrets: inherit
with:
test_mark: 'nightly_sweeps'
test_group_cnt: 4
test_group_ids: '[1,2,3,4]'
2 changes: 2 additions & 0 deletions .github/workflows/on-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ jobs:
secrets: inherit
with:
test_mark: 'nightly'
test_group_cnt: 4
test_group_ids: '[1,2,3,4]'
2 changes: 2 additions & 0 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
secrets: inherit
with:
test_mark: 'push'
test_group_cnt: 2
test_group_ids: '[1,2]'
perf-benchmark:
needs: docker-build
uses: ./.github/workflows/perf-benchmark.yml
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ jobs:
secrets: inherit
with:
test_mark: 'push'
test_group_cnt: 2
test_group_ids: '[1,2]'

0 comments on commit 8aebefb

Please sign in to comment.