Add Radon analysis workflow for cyclomatic complexity checks #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Radon Cyclomatic Complexity | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
radon-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install radon | |
- name: Run Radon Cyclomatic Complexity | |
id: radon | |
run: | | |
radon cc -s -a src/masoniteorm/collection > radon_output.txt | |
output=$(cat radon_output.txt) | |
echo "$output" | |
echo "radon_output=$output" >> $GITHUB_ENV | |
- name: Comment on Pull Request | |
if: github.event_name == 'pull_request' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
header: Radon Cyclomatic Complexity Report | |
message: | | |
```console | |
${{ env.radon_output }} | |
``` |