fix flake8 lint #1617
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, lint, and perform static code analysis | |
# All unit tests found in the tests/ directory are run. | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Run tests | |
on: push | |
jobs: | |
linting-flake8: | |
name: Lint Python with flake8 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout github repo | |
uses: actions/checkout@v2 | |
- name: Install flake8 | |
run: | | |
python -m pip install flake8==7.1.0 flake8-docstrings==1.7.0 flake8-annotations==3.1.1 | |
- name: Run lint with flake8 | |
run: | | |
flake8 src otakaro floodresilience | |
linting-pylint: | |
name: Lint Python with pylint | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout github repo | |
uses: actions/checkout@v2 | |
- name: Install package dependencies | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yml | |
# only cache environment | |
cache-environment: true | |
cache-downloads: false | |
- run: | | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
- name: Install pylint | |
run: | | |
python -m pip install pylint==3.2.6 | |
- name: Run lint with pylint | |
run: | | |
pylint src otakaro floodresilience | |
unit-tests: | |
name: Run unit tests with pytest | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout github repo including lfs files | |
uses: actions/checkout@v2 | |
with: | |
lfs: true | |
- name: Install package dependencies | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yml | |
# only cache environment | |
cache-environment: true | |
cache-downloads: false | |
- run: | | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
- name: Create .env file with API keys | |
env: | |
ENV_BASE64: ${{ secrets.ENV_BASE64 }} | |
run: | | |
echo import .env file from secrets and regenerate the file | |
echo $ENV_BASE64 | base64 -d > .env | |
- name: Run tests with pytest | |
env: | |
TEST_DATABASE_INTEGRATION: "false" | |
run: | | |
pytest | |
sonarcloud: | |
name: Run static-code analysis on SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout github repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |