fix: black bug #320
Workflow file for this run
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
name: CD | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
prep-testbed: | ||
if: | | ||
!startsWith(github.event.head_commit.message, 'chore') && | ||
!startsWith(github.event.head_commit.message, 'build: hotfix') && | ||
!endsWith(github.event.head_commit.message, 'reformatted by jina-dev-bot') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: set-matrix | ||
run: | | ||
sudo apt-get install jq | ||
echo '::set-output name=matrix::$(bash scripts/get-all-test-paths.sh)' | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
core-test: | ||
needs: prep-testbed | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.7] | ||
test-path: ${{fromJson(needs.prep-testbed.outputs.matrix)}} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Prepare enviroment | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install wheel | ||
pip install --no-cache-dir 'client/[test]' | ||
pip install --no-cache-dir 'server/[onnx]' | ||
pip install --no-cache-dir 'server/[transformers]' | ||
pip install --no-cache-dir 'server/[search]' | ||
pip install --no-cache-dir 'server/[cn_clip]' | ||
- name: Test | ||
id: test | ||
run: | | ||
pytest --suppress-no-test-exit-code --cov=clip_client --cov=clip_server --cov-report=xml \ | ||
-v -s -m 'not gpu' ${{ matrix.test-path }} | ||
echo '::set-output name=codecov_flag::cas' | ||
timeout-minutes: 30 | ||
- name: Check codecov file | ||
id: check_files | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: 'coverage.xml' | ||
- name: Upload coverage from test to Codecov | ||
uses: codecov/codecov-action@v2 | ||
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.7' | ||
with: | ||
file: coverage.xml | ||
flags: ${{ steps.test.outputs.codecov_flag }} | ||
fail_ci_if_error: false | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
gpu-test: | ||
needs: prep-testbed | ||
runs-on: [self-hosted, x64, gpu, linux] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ 3.7 ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# For coverage builds fetch the whole history | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Prepare enviroment | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install wheel pytest pytest-cov nvidia-pyindex | ||
pip install -e 'client/[test]' | ||
pip install -e 'server/[tensorrt]' | ||
- name: Test | ||
id: test | ||
run: | | ||
pytest --suppress-no-test-exit-code --cov=clip_client --cov=clip_server --cov-report=xml \ | ||
-v -s -m 'gpu' ./tests/test_tensorrt.py | ||
echo '::set-output name=codecov_flag::cas' | ||
timeout-minutes: 30 | ||
env: | ||
# fix re-initialized torch runtime error on cuda device | ||
JINA_MP_START_METHOD: spawn | ||
- name: Check codecov file | ||
id: check_files | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: 'coverage.xml' | ||
- name: Upload coverage from test to Codecov | ||
uses: codecov/codecov-action@v3 | ||
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.7' | ||
with: | ||
file: coverage.xml | ||
name: gpu-related-codecov | ||
flags: ${{ steps.test.outputs.codecov_flag }} | ||
fail_ci_if_error: false | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
prerelease: | ||
needs: [core-test, gpu-test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 100 | ||
- name: Pre-release (.devN) | ||
run: | | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
pip install twine wheel | ||
./scripts/release.sh | ||
env: | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
- name: Pre-release docker (.devN) | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: Manual Docker Build | ||
inputs: '{ 'release_token': '${{ env.release_token }}', 'triggered_by': 'CD'}' | ||
token: ${{ secrets.JINA_DEV_BOT }} | ||
env: | ||
release_token: ${{ secrets.CAS_RELEASE_TOKEN }} | ||
- uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: Manual CAS Docker Build | ||
inputs: '{ 'release_token': '${{ env.release_token }}', 'triggered_by': 'CD'}' | ||
token: ${{ secrets.JINA_DEV_BOT }} | ||
env: | ||
release_token: ${{ secrets.CAS_RELEASE_TOKEN }} | ||
- name: Pre-release hub (.devN) | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: Manual Hub Push | ||
inputs: '{ 'release_token': '${{ env.release_token }}', 'triggered_by': 'CD'}' | ||
token: ${{ secrets.JINA_DEV_BOT }} | ||
env: | ||
release_token: ${{ secrets.CAS_RELEASE_TOKEN }} |