update linting workflow

This commit is contained in:
WieErWill 2023-12-10 16:12:46 +01:00
parent 7aba5cf373
commit 274c69d0c4

View File

@ -1,61 +1,81 @@
name: Lint Code Base name: Lint Code Base and Measure Performance
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
build: lint-python:
name: Lint name: Lint Python
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
steps: steps:
# Checkout the repository
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v2 uses: actions/checkout@v2
# Setup Python
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: '3.x' python-version: '3.x'
# Lint Python files - name: Lint Python Files
- name: Lint Python
run: | run: |
pip install flake8 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 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 flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# Setup Node.js for JavaScript and TypeScript lint-javascript:
name: Lint JavaScript
runs-on: ubuntu-latest
needs: lint-python
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '16'
# Lint JavaScript files - name: Lint JavaScript Files
- name: Lint JavaScript
run: | run: |
npm install npm install
npm run lint npm run lint
# Lint TypeScript files lint-typescript:
- name: 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: | run: |
npm install npm install
npm run lint npm run lint
# Setup Rust lint-rust:
name: Lint Rust
runs-on: ubuntu-latest
needs: lint-typescript
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Rust - name: Set up Rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
override: true override: true
# Lint Rust files - name: Lint Rust Files
- name: Lint Rust
run: | run: |
for dir in Day*/rust; do for dir in Day*/rust; do
if [ -d "$dir" ]; then if [ -d "$dir" ]; then
@ -65,3 +85,24 @@ jobs:
cd - # Go back to the root directory cd - # Go back to the root directory
fi fi
done 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