milvus/.github/workflows/main.yaml
quicksilver d66d48c6b6 Enable UnitTest
Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
2020-10-27 15:51:16 +08:00

77 lines
2.3 KiB
YAML

name: Build and test
# TODO: do not trigger action for some document file update
# This workflow is triggered on pushes or pull request to the repository.
on:
push:
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'scripts/**'
- 'internal/**'
- 'cmd/**'
- '.github/workflows/main.yaml'
- docker-compose.yml
- '!**.md'
- '!**_test.go'
pull_request:
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'scripts/**'
- 'internal/**'
- 'cmd/**'
- '.github/workflows/main.yaml'
- docker-compose.yml
- '!**.md'
- '!**_test.go'
jobs:
ubuntu:
name: AMD64 Ubuntu ${{ matrix.ubuntu }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
ubuntu: [18.04]
env:
UBUNTU: ${{ matrix.ubuntu }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check Dockerfile
uses: reviewdog/action-hadolint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check # Default is github-pr-check
- name: Docker Pull
shell: bash
run: |
docker-compose pull --ignore-pull-failures ubuntu
- name: Docker Build
shell: bash
run: |
docker-compose build ubuntu
docker rmi $(docker images | grep '<none>' | awk '{print $3}') || exit 0
- name: Cache Docker Volumes
uses: actions/cache@v1
with:
path: .docker
key: ubuntu${{ matrix.ubuntu }}-${{ hashFiles('internal/core/**') }}
restore-keys: ubuntu${{ matrix.ubuntu }}-
- name: Docker Run
run: |
docker-compose run ubuntu
- name: Run UnitTest
shell: bash
run: |
cd ${GITHUB_WORKSPACE}/deployments/docker && docker-compose up -d
cd ${GITHUB_WORKSPACE}/scripts/ && ./run_unittest.sh
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'zilliztech/milvus-distributed'
continue-on-error: true
shell: bash
run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }}
docker-compose push ubuntu