Skip to content

Commit

Permalink
[CI] Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Weiming Zhao committed Aug 13, 2021
1 parent 51efd21 commit e666cc8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 44 deletions.
11 changes: 6 additions & 5 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: "Build Halo"
description: "Build and test HALO"
name: "Run in container"
description: "Run in Halo Container"
inputs:
docker_image_variant:
description: "Docker image variant"
required: true
default: "x86_64"
cmd:
description: "Shell command run in container"
required: true
runs:
using: "composite"
steps:
- run: echo "Curr:${{runner.workspace}}"
shell: bash
- run: ./halo/.github/actions/build/build_in_docker.sh
${{runner.workspace}}/heterogeneity-aware-lowering-and-optimization
${{ inputs.docker_image_variant }}
${{ inputs.docker_image_variant }} ${{ inputs.cmd }}
shell: bash
39 changes: 9 additions & 30 deletions .github/actions/build/build_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,25 @@ REPO="registry-intl.us-west-1.aliyuncs.com/computation/halo"
VER="latest"
FLAVOR="devel"

MOUNT_DIR="$PWD"
if [ ! -z "$1" ]; then
MOUNT_DIR=$1
shift
fi

VARIANT="x86_64"
if [ ! -z "$1" ]; then
VARIANT=$1
shift
fi
MOUNT_DIR=$1
shift

VARIANT=$1
shift

IMAGE="$REPO:$VER-$FLAVOR-$VARIANT-ubuntu18.04"
CONTAINER_NAME="halo.ci-$VER-$VARIANT"

docker_run_flag=""
cmake_flags="-DDNNL_COMPILER=gcc-10"
check_cmds="ninja check-halo && ninja check-halo-models"

if [[ "$VARIANT" =~ cuda ]]; then
docker_run_flag="--runtime=nvidia"
fi

cmake_flags="$cmake_flags -DHALO_USE_STATIC_PROTOBUF=ON -DCPACK_SYSTEM_NAME=ubuntu-i686"

DOCKER_ID=`docker ps -aq -f name=$CONTAINER_NAME -f status=running`

gid=$(id -g ${USER})
group=$(id -g -n ${USER})
uid=$(id -u ${USER})
extra_mnt="-v /opt/poplar_sdk:/opt/poplar_sdk:ro"
mkdir -p /tmp/ubuntu.cache
extra_mnt="$extra_mnt -v /tmp/ubuntu.cache:/cache"

rm -fr $MOUNT_DIR/output_ubuntu && mkdir -p $MOUNT_DIR/output_ubuntu
extra_cmd="source /opt/poplar_sdk/poplar/enable.sh" # dummy command
cmd="cd /build && cmake -G Ninja $cmake_flags /host/halo "
cmd="$cmd && ninja && $extra_cmd && ninja && $check_cmds && ninja package "
cmd="$cmd && cp /build/*.bz2 /host/output_ubuntu"
docker run -e CCACHE_DIR=/cache $docker_run_flag -v $MOUNT_DIR:/host \
--tmpfs /build:exec --tmpfs /tmp:exec --entrypoint="" \
$extra_mnt --rm --user $uid:$gid $IMAGE bash -c "$cmd"
-v /opt/poplar_sdk:/opt/poplar_sdk:ro \
-v /tmp/ubuntu.cache:/cache \
-v /tmp/build_ubuntu:/build --tmpfs /tmp:exec \
--entrypoint="" \
$extra_mnt --rm --user $uid:$gid -w /build $IMAGE bash -c "$*"
49 changes: 40 additions & 9 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,44 @@ jobs:
runs-on: [self-hosted]
needs: [checkout]
steps:
- name: build
- name: Prepare
run: |
rm -fr /tmp/build_ubuntu && mkdir -p /tmp/build_ubuntu
- name: Build
uses: ./halo/.github/actions/build
with:
docker_image_variant: cuda10.0-cudnn7
cmd: |
cmake -G Ninja /host/halo -DDNNL_COMPILER=gcc-10 -DHALO_USE_STATIC_PROTOBUF=ON -DCPACK_SYSTEM_NAME=ubuntu-i686
ninja
ninja package
- name: upload_artifacts
uses: actions/upload-artifact@v2
- name: uild
uses: ./halo/.github/actions/build
with:
name: artifact
path: |
${{runner.workspace}}/heterogeneity-aware-lowering-and-optimization/output_ubuntu/*.bz2
if-no-files-found: error
docker_image_variant: cuda10.0-cudnn7
cmd: ccache -s

- name: Unit Tests
uses: ./halo/.github/actions/build
with:
docker_image_variant: cuda10.0-cudnn7
cmd: |
source /opt/poplar_sdk/poplar/enable.sh
ninja check-halo
- name: Model Tests
uses: ./halo/.github/actions/build
with:
docker_image_variant: cuda10.0-cudnn7
cmd: "ninja check-halo-models"

- name: Package
uses: ./halo/.github/actions/build
with:
docker_image_variant: cuda10.0-cudnn7
cmd: "ninja package"

build_centos7:
runs-on: [self-hosted]
Expand All @@ -81,18 +107,23 @@ jobs:
image_registry : registry-intl.us-west-1.aliyuncs.com
image_tag : latest-devel-x86_64-centos7

- name: upload_artifacts
upload_artifacts:
runs-on: [self-hosted]
needs: [build_ubuntu, build_centos7]
steps:
- name: Upload
uses: actions/upload-artifact@v2
with:
name: artifact
path: |
${{runner.workspace}}/heterogeneity-aware-lowering-and-optimization/output_centos/*.bz2
${{runner.workspace}}/heterogeneity-aware-lowering-and-optimization/output_centos/*.rpm
/tmp/build_ubuntu/*.bz2
if-no-files-found: error

publish_images:
runs-on: [self-hosted]
needs: [build_ubuntu, build_centos7]
needs: [upload_artifacts]
services:
registry:
image: registry:2
Expand Down

0 comments on commit e666cc8

Please sign in to comment.