Update - Nibbler Placeholder (#307) #2023
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
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 --exclude frontends/web/node_modules . | |
- 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 |