Skip to content

Force produce data workflow #5

Force produce data workflow

Force produce data workflow #5

Workflow file for this run

name: Build and Test
on:
workflow_dispatch:
workflow_call:
push:
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
build:
- runs-on: runner
runs-on:
- in-service
- ${{ matrix.build.runs-on }}
container:
image: ghcr.io/${{ github.repository }}/tt-forge-fe-ci-ubuntu-22-04:latest
options: --user root --device /dev/tenstorrent/0
volumes:
- /dev/hugepages:/dev/hugepages
- /dev/hugepages-1G:/dev/hugepages-1G
- /etc/udev/rules.d:/etc/udev/rules.d
- /lib/modules:/lib/modules
- /opt/tt_metal_infra/provisioning/provisioning_env:/opt/tt_metal_infra/provisioning/provisioning_env
steps:
- name: Install jq and curl
run: |
apt-get update
apt-get install -y jq curl # TODO move to Dockerfile
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
JOB_ID=$(curl -s -H "Authorization: token ${{ github.token }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | \
jq -r '.jobs[] | select(.name | startswith("${{ github.job }}")) | .id')
echo "job-id=$JOB_ID" >> "$GITHUB_OUTPUT"
echo "test_report_path=reports/report_$JOB_ID.xml" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Fetch all history and tags
# Clean everything from submodules (needed to avoid issues
# with cmake generated files leftover from previous builds)
- name: Cleanup submodules
run: |
git submodule foreach --recursive git clean -ffdx
git submodule foreach --recursive git reset --hard
- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
key: ${{ matrix.build.runs-on }}-runtime-${{ matrix.build.enable_runtime }}-${{ env.SDK_VERSION }}
- name: Build
shell: bash
run: |
source env/activate
cmake -G Ninja \
-B ${{ steps.strings.outputs.build-output-dir }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build ${{ steps.strings.outputs.build-output-dir }}
- name: Run Unit Tests
shell: bash
run: |
source env/activate
cmake --build ${{ steps.strings.outputs.build-output-dir }} -- run_unit_tests
- name: Run Test
shell: bash
run: |
source env/activate
pytest --junit-xml=${{ steps.strings.outputs.test_report_path }} 2>&1 | tee pytest.log
- name: Upload Test Log
uses: actions/upload-artifact@v4
with:
name: test-log-${{ matrix.build.runs-on }}
path: pytest.log
- name: Upload Test Report
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.build.runs-on }}
path: ${{ steps.strings.outputs.test_report_path }}
- name: Show Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: ${{ steps.strings.outputs.test_report_path }}
check_name: TT-Forge-FE Tests