vectordb/.github/workflows/ci.yml

149 lines
4.4 KiB
YAML

name: CI
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.5.0
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
lint-flake-8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.5.0
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .git,__pycache__,docs/source/conf.py,old,build,dist,tests/
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude .git,__pycache__,docs/source/conf.py,old,build,dist,tests/
check-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.5.0
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- id: file_changes
uses: Ana06/get-changed-files@v1.2
- name: check black
run: ./scripts/black.sh
env:
CHANGED_FILES: ${{ steps.file_changes.outputs.added_modified }}
prep-testbed:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Dependency
run: |
sudo apt-get install jq
- id: set-matrix-unit
run: |
echo "::set-output name=matrix::$(bash scripts/get-all-test-paths.sh unit 1)"
- id: set-matrix-integration
run: |
echo "::set-output name=matrix::$(bash scripts/get-all-test-paths.sh integration 1)"
outputs:
matrix-unit: ${{ steps.set-matrix-unit.outputs.matrix }}
matrix-integration: ${{ steps.set-matrix-integration.outputs.matrix }}
unit-tests:
needs: prep-testbed
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9]
test-path: ${{fromJson(needs.prep-testbed.outputs.matrix-unit)}}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Prepare environment
run: |
python -m pip install --upgrade pip
python -m pip install wheel
pip install pytest
pip install pytest-repeat
pip install pytest-timeout
pip install flaky
pip install .
pip install -U docarray[hnswlib]>=0.34.0
- name: Test
id: test
run: |
pytest -v -s --force-flaky --min-passes 1 --max-runs 5 ${{ matrix.test-path }}
timeout-minutes: 30
integration-tests:
needs: prep-testbed
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9]
test-path: ${{fromJson(needs.prep-testbed.outputs.matrix-integration)}}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Prepare environment
run: |
python -m pip install --upgrade pip
python -m pip install wheel
pip install pytest
pip install pytest-repeat
pip install pytest-timeout
pip install flaky
pip install .
pip install -U docarray[hnswlib]>=0.34.0
- name: Test
id: test
run: |
pytest -v -s --force-flaky --min-passes 1 --max-runs 5 ${{ matrix.test-path }}
timeout-minutes: 30
# just for blocking the merge until all parallel integration-tests are successful
success-all-test:
needs:
- unit-tests
- integration-tests
if: always()
runs-on: ubuntu-latest
steps:
- uses: technote-space/workflow-conclusion-action@v2
- name: Check Failure
if: env.WORKFLOW_CONCLUSION == 'failure'
run: exit 1
- name: Success
if: ${{ success() }}
run: echo "All Done"