Skip to content

Commit

Permalink
Separate runners for each test.
Browse files Browse the repository at this point in the history
  • Loading branch information
uazizTT committed Nov 16, 2024
1 parent f71ec73 commit 2f16e22
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 15 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ jobs:
needs: [pre-commit, spdx]
uses: ./.github/workflows/run-build.yml
secrets: inherit
collect_dirs:
runs-on: ubuntu-latest
outputs:
dirs: ${{ steps.dirs.outputs.dirs }}
steps:
- uses: actions/checkout@v2
- id: dirs
run: echo "dirs=$(ls -d tests/models/*/ | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
test:
needs: build
needs: [build, collect_dirs]
strategy:
matrix:
dir: ${{ fromJson(needs.collect_dirs.outputs.dirs) }}
uses: ./.github/workflows/run-tests.yml
secrets: inherit
38 changes: 38 additions & 0 deletions .github/workflows/run-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,43 @@ jobs:
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
- name: wuhhwe ihhjwed
id: GHuhed
shell: bash
env:
job-name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.test_group_id }})"
run: |
apt-get install jq -y
apt-get install curl -y
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
echo "Expected job name: ${{ env.job-name }}"
JOB_ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs" | \
jq -r '.jobs[] | select(.name | contains("${{ env.job-name }}")) | .id ')
- name: iuhihid hjijhd
id: strineds
shell: bash
run: |
apt-get install jq -y
apt-get install curl -y
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
jobs=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs")
job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
job_name=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .name')
job_name="test (tests/models/autoencoder_linear/) / tests"
job_name=${job_name:6}
job_name=${job_name%)*}
echo "job_id=$job_id" >> "$GITHUB_OUTPUT"
echo "job_name=$job_name" >> "$GITHUB_OUTPUT"
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 }}

Expand All @@ -145,6 +182,7 @@ jobs:
shell: bash
run: |
source env/activate
apt-get install jq -y
cmake --build ${{ steps.strings.outputs.build-output-dir }}
cmake --install ${{ steps.strings.outputs.build-output-dir }}
Expand Down
49 changes: 35 additions & 14 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ jobs:
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
build: [
{runs-on: n150, name: "run"},
]

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

container:
image: ghcr.io/tenstorrent/tt-torch/tt-torch-ci-ubuntu-22-04:latest
Expand All @@ -37,10 +32,39 @@ jobs:
submodules: recursive
lfs: true

- name: Set GH
id: GH
shell: bash
env:
job-name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.test_group_id }})"
run: |
apt-get install jq -y
apt-get install curl -y
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
echo "Expected job name: ${{ env.job-name }}"
JOB_ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs" | \
jq -r '.jobs[] | select(.name | contains("${{ env.job-name }}")) | .id ')
- name: Set reusable strings
id: strings
shell: bash
run: |
apt-get install jq -y
apt-get install curl -y
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
jobs=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs")
job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
job_name=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .name')
job_name="test (tests/models/autoencoder_linear/) / tests"
job_name=${job_name:6}
job_name=${job_name%)*}
echo "job_id=$job_id" >> "$GITHUB_OUTPUT"
echo "job_name=$job_name" >> "$GITHUB_OUTPUT"
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -73,13 +97,10 @@ jobs:
- name: Run PyTorch tests
shell: bash
run: |
echo ${{ steps.strings.outputs.work-dir }}
echo ${{ steps.strings.outputs.test-dir }}
echo ${{ steps.strings.outputs.build-output-dir }}
echo ${{ steps.strings.outputs.install-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 -v tests/torch
- name: Run ONNX tests
shell: bash
run: |
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 -v tests/onnx
pytest -v ${{ steps.strings.outputs.job_name }}

0 comments on commit 2f16e22

Please sign in to comment.