108 lines
2.5 KiB
YAML
108 lines
2.5 KiB
YAML
name: Lint Code Base and Measure Performance
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
lint-python:
|
|
name: Lint Python
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- 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
|
|
|
|
lint-javascript:
|
|
name: Lint JavaScript
|
|
runs-on: ubuntu-latest
|
|
needs: lint-python
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
|
|
- name: Lint JavaScript Files
|
|
run: |
|
|
npm install
|
|
npm run lint
|
|
|
|
lint-typescript:
|
|
name: Lint TypeScript
|
|
runs-on: ubuntu-latest
|
|
needs: lint-javascript
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
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@v3
|
|
|
|
- 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 |