diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 6109ab95..0f97d3d6 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -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 diff --git a/.github/workflows/run-build.yml b/.github/workflows/run-build.yml index d6ce7df6..b93f24d4 100644 --- a/.github/workflows/run-build.yml +++ b/.github/workflows/run-build.yml @@ -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 }} @@ -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 }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b6789ce3..aa42693f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -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 @@ -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" @@ -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 }}