Skip to content

5f70600710

5f70600710 #142

name: scrapers-cicd
on:
push:
branches: [ "main" ]
paths:
- 'scrapers/*/**'
pull_request:
branches: [ "main" ]
paths:
- 'scrapers/*/**'
jobs:
test_pyapps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
architecture: "x64"
env:
AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache
- name: Install Pipenv
run: |
python -m pip install pipenv
- name: Install requirements
run: |
pipenv install --dev --verbose
- name: Run tests
run: |
pipenv run python -m pytest tests/ -s
- name: Format-Lint-Sort
run: |
if [[ $(git diff-tree --no-commit-id --name-only --diff-filter=ACMRT -r ${{ github.sha }} -- '*.py' | xargs) ]]; then
pipenv run python -m black --check $(git diff-tree --no-commit-id --name-only --diff-filter=ACMRT -r "$GITHUB_SHA" -- '*.py' | xargs)
pipenv run python -m isort $(git diff-tree --no-commit-id --name-only --diff-filter=ACMRT -r "$GITHUB_SHA" -- '*.py' | xargs)
pipenv run python -m pylint $(git diff-tree --no-commit-id --name-only --diff-filter=ACMRT -r "$GITHUB_SHA" -- '*.py' | xargs)
fi