Skip to content

Improvements

Improvements #1222

Workflow file for this run

name: Linter Tests
# This workflow is triggered on pushes to the repository or external PRs.
on: [push, pull_request]
jobs:
lint:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'facebookresearch/dynabench'
strategy:
fail-fast: false
max-parallel: 3
matrix:
lint: ['flake8', 'black', 'isort', 'prettier', 'stylelint', 'eslint']
runs-on: ubuntu-latest
steps:
- name: Checkout branch 🛎️
uses: actions/checkout@v2
- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: dynabench
python-version: 3.7
auto-update-conda: true
use-only-tar-bz2: true
- name: Use Node
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install Dependencies
shell: bash -l {0}
run: |
conda activate dynabench
python -m pip install --upgrade pip
pip install --progress-bar off flake8==3.7.9
pip install --progress-bar off isort==5.10.1
pip install --progress-bar off black==22.3.0
npm install --prefix frontends/web/
- name: Run linter
shell: bash -l {0}
if: matrix.lint == 'flake8'
run: |
conda activate dynabench
flake8 --version
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
# exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=18 --max-line-length=88 --statistics
- name: Run linter
shell: bash -l {0}
if: matrix.lint == 'isort'
run: |
conda activate dynabench
isort --version
isort --check --diff .
- name: Run linter
shell: bash -l {0}
if: matrix.lint == 'black'
run: |
conda activate dynabench
black --version
black --check .
- name: Run linter
if: matrix.lint == 'stylelint'
run: |
npm run --prefix frontends/web/ stylelint **/*.css
- name: Run linter
if: matrix.lint == 'prettier'
run: |
npm run --prefix frontends/web/ prettier
- name: Run linter
if: matrix.lint == 'eslint'
run: |
npm run --prefix frontends/web/ eslint