Skip to content

pre-commit & pytest #101

pre-commit & pytest

pre-commit & pytest #101

name: pre-commit & pytest
on:
pull_request:
push:
branches: [main]
pull_request_review:
types: [submitted]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip/pre-commit cache
uses: actions/cache@v3
with:
path: |
${{ steps.pip-cache.outputs.dir }}
~/.cache/pre-commit
key: ${{ runner.os }}-pip-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pip-pre-commit
- name: pre-commit
run: |
pip install -U pre-commit
pre-commit install --install-hooks
pre-commit run -a
pytest:
runs-on: ubuntu-latest
needs: pre-commit
container:
image: nvcr.io/nvidia/tritonserver:23.08-pyt-python-py3
options:
--shm-size=1g
steps:
- uses: actions/checkout@v3
- name: test bash
env:
TRITON_HOST: localhost
TRITON_HTTP: 8000
TRITON_GRPC: 8001
TRITON_RETRIES: 2
TRITON_CLIENT_TIMEOUT: 1
run: |
tritonserver --model-repo=$GITHUB_WORKSPACE/model_repository &
pip install .[tests]
sleep 3
curl -v ${TRITON_HOST}:${TRITON_HTTP}/v2/health/ready
coverage run --source=tritony -m pytest
- name: Upload coverage data to coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
coveralls:
name: Indicate completion to coveralls.io
needs: pytest
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}