Trigger pre-deploy on push to main #1
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
# This workflow will install Python dependencies, run tests and lint | |
name: pre-deploy (linters and tests) | |
on: | |
# run only when finance/ folder is changed | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
paths: | |
- 'finance/**' | |
jobs: | |
pylint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pylint | |
- name: Analysing the code with pylint | |
# if score is less than 1, the build will fail | |
run: | | |
pylint $(git ls-files '*.py') --fail-under=1 | |
format: | |
name: check code style with black | |
uses: ahnazary/actions-library/.github/workflows/black.yaml@main | |
flake8: | |
name: check code style with flake8 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: run flake8 | |
run: | | |
pip install flake8 | |
flake8 --max-line-length=99 --extend-ignore=E402 |