68 lines
1.6 KiB
YAML
68 lines
1.6 KiB
YAML
name: Lint Code Base
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
steps:
|
|
# Checkout the repository
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
# Setup Python
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
# Lint Python files
|
|
- name: Lint Python
|
|
run: |
|
|
pip install flake8
|
|
# Stop the build if there are Python syntax errors or undefined names
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
# Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
|
|
# Setup Node.js for JavaScript and TypeScript
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
|
|
# Lint JavaScript files
|
|
- name: Lint JavaScript
|
|
run: |
|
|
npm install
|
|
npm run lint
|
|
|
|
# Lint TypeScript files
|
|
- name: Lint TypeScript
|
|
run: |
|
|
npm install
|
|
npm run lint
|
|
|
|
# Setup Rust
|
|
- name: Set up Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
|
|
# Lint Rust files
|
|
- name: Lint Rust
|
|
run: |
|
|
for dir in Day*/rust; do
|
|
if [ -d "$dir" ]; then
|
|
echo "Linting $dir"
|
|
cd $dir
|
|
cargo clippy -- -D warnings
|
|
cd - # Go back to the root directory
|
|
fi
|
|
done
|