advent_of_code_2023/.github/workflows/lint.yml

108 lines
2.5 KiB
YAML
Raw Normal View History

2023-12-10 15:12:46 +00:00
name: Lint Code Base and Measure Performance
2023-12-06 19:39:05 +00:00
on: [push, pull_request]
jobs:
2023-12-10 15:12:46 +00:00
lint-python:
name: Lint Python
2023-12-06 19:39:05 +00:00
runs-on: ubuntu-latest
steps:
2023-12-10 15:12:46 +00:00
- name: Checkout Repository
2023-12-10 16:34:37 +00:00
uses: actions/checkout@v3
2023-12-10 15:12:46 +00:00
- name: Set up Python
2023-12-10 16:34:37 +00:00
uses: actions/setup-python@v3
2023-12-10 15:12:46 +00:00
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
2023-12-10 16:34:37 +00:00
uses: actions/checkout@v3
2023-12-10 15:12:46 +00:00
- name: Set up Node.js
2023-12-10 16:34:37 +00:00
uses: actions/setup-node@v3
2023-12-10 15:12:46 +00:00
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
2023-12-10 16:34:37 +00:00
uses: actions/checkout@v3
2023-12-10 15:12:46 +00:00
- name: Set up Node.js
2023-12-10 16:34:37 +00:00
uses: actions/setup-node@v3
2023-12-10 15:12:46 +00:00
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
2023-12-10 16:34:37 +00:00
uses: actions/checkout@v3
2023-12-10 15:12:46 +00:00
- 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