Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
add tests and nodes
Browse files Browse the repository at this point in the history
Signed-off-by: Wenxin Zhang <wenxin.zhang@intel.com>
  • Loading branch information
VincyZhang committed Jan 5, 2024
1 parent 9e20bd1 commit 1d1bbaf
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/unit-test-bestla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Bestla Unit Test

on:
pull_request:
branches: [main]
paths:
- bestla/**"
- .github/workflows/unit-test-bestla.yml
- '!bestla/README.md'
workflow_dispatch:

# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
DOCKER_CONFIG_NAME: "commonDockerConfig"
REPO_NAME: "neural-speed"
REPO_TAG: "py38"
DOCKER_FILE_NAME: "devel"
CONTAINER_NAME: "utTest"

jobs:
unit-test:
runs-on: [self-hosted, linux, X64, spr]
steps:
- name: Docker Clean Up
run: |
docker ps -a
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}-${{ runner.name }}'$) ]]; then
docker start ${{ env.CONTAINER_NAME }}-${{ runner.name }}
echo "remove left files through container ..."
docker exec ${{ env.CONTAINER_NAME }}-${{ runner.name }} bash -c "ls -a /neural-speed && rm -fr /neural-speed/* && rm -fr /neural-speed/.* || true"
fi
- name: Checkout out Repo
uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-tags: true

- name: Docker Build
run: |
docker build -f ${{ github.workspace }}/.github/workflows/docker/${{ env.DOCKER_FILE_NAME }}.dockerfile -t ${{ env.REPO_NAME }}:${{ env.REPO_TAG }} .
- name: Docker Run
run: |
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}'$) ]]; then
docker stop ${{ env.CONTAINER_NAME }}
docker rm -vf ${{ env.CONTAINER_NAME }} || true
fi
docker run -dit --disable-content-trust --privileged --name=${{ env.CONTAINER_NAME }}-${{ runner.name }} -v /dev/shm:/dev/shm \
-v ${{ github.workspace }}:/neural-speed \
-v /dataset/tf_dataset2:/tf_dataset2 \
-v ~/.cache/oneAPI:/cache \
${{ env.REPO_NAME }}:${{ env.REPO_TAG }}
- name: Env build
run: |
docker exec ${{ env.CONTAINER_NAME }}-${{ runner.name }} \
bash /neural-speed/.github/workflows/scripts/prepare_env.sh
- name: Run UT
run: |
docker exec ${{ env.CONTAINER_NAME }}-${{ runner.name }} \
bash -c "cd /neural-speed/bestla && mkdir build && cd build && cmake .. -DBTLA_UT_ALL=ON && make -j \
&& ./bestla_ut 2>&1 | tee unit_test_bestla.log"
- name: Check Result
run: |
docker exec ${{ env.CONTAINER_NAME }}-${{ runner.name }} \
bash -c "cd /neural-speed/bestla \
&& [[ $(grep -c "Case Failed" unit_test_bestla.log) != 0 ]] && echo "UT Failed! Please check UT log."
- name: Publish pipeline artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: Bestla Unit Test
path: ${{ github.workspace }}/unit_test*.*

0 comments on commit 1d1bbaf

Please sign in to comment.