update linting workflow
This commit is contained in:
parent
7aba5cf373
commit
274c69d0c4
147
.github/workflows/lint.yml
vendored
147
.github/workflows/lint.yml
vendored
@ -1,67 +1,108 @@
|
||||
name: Lint Code Base
|
||||
name: Lint Code Base and Measure Performance
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Lint
|
||||
lint-python:
|
||||
name: Lint Python
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
# Checkout the repository
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Setup Python
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- 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
|
||||
- name: Lint Python Files
|
||||
run: |
|
||||
pip install flake8
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
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:
|
||||
name: Lint JavaScript
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint-python
|
||||
|
||||
# Lint JavaScript files
|
||||
- name: Lint JavaScript
|
||||
run: |
|
||||
npm install
|
||||
npm run lint
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Lint TypeScript files
|
||||
- name: Lint TypeScript
|
||||
run: |
|
||||
npm install
|
||||
npm run lint
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
# Setup Rust
|
||||
- name: Set up Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
- name: Lint JavaScript Files
|
||||
run: |
|
||||
npm install
|
||||
npm run lint
|
||||
|
||||
# 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
|
||||
lint-typescript:
|
||||
name: Lint TypeScript
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint-javascript
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Lint TypeScript Files
|
||||
run: |
|
||||
npm install
|
||||
npm run lint
|
||||
|
||||
lint-rust:
|
||||
name: Lint Rust
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint-typescript
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Lint Rust Files
|
||||
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
|
||||
|
||||
measure_performance:
|
||||
name: Measure Performance
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint-python, lint-javascript, lint-typescript, lint-rust]
|
||||
timeout-minutes: 15 # Timeout set to 15 minutes
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run Performance Measurement Script
|
||||
run: |
|
||||
chmod +x ./measure_performance.sh
|
||||
./measure_performance.sh
|
||||
|
||||
- name: Upload Analytics.md
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Analytics
|
||||
path: Analytics.md
|
Loading…
Reference in New Issue
Block a user