This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Wenxin Zhang <wenxin.zhang@intel.com>
- Loading branch information
1 parent
9e20bd1
commit 1d1bbaf
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*.* |