Skip to content

[Infra] Docker configs #24

[Infra] Docker configs

[Infra] Docker configs #24

name: Lint and Tests
on:
pull_request:
types: [opened, synchronize]
env:
MONGODB_URL: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.0
jobs:
flake8_py3:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ['latest']
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.9
architecture: x64
- name: Checkout PyTorch
uses: actions/checkout@master
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r dev-requirements.txt
- name: Run flake8
uses: suo/flake8-github-action@releases/v1
with:
checkName: 'flake8_py3' # NOTE: This needs to be the same as the job name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run pytest
run: docker-compose run --rm app sh -c "python -m pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=app tests/"
- name: Pytest coverage report
id: coverageReport
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
- name: Validate high coverage level
run: |
echo "Coverage Percentage - ${{ steps.coverageReport.outputs.coverage }}"
[[ '${{ steps.coverageReport.outputs.color }}' != 'brightgreen' ]] && echo "Coverage needs to be over 90%" && exit 1
echo "ok"