Add Radon analysis workflow for cyclomatic complexity checks #4
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 | |
run: | | |
radon cc -s -a src/masoniteorm/collection > radon_output.txt | |
- name: Read Radon Output | |
id: radon | |
run: | | |
output=$(cat radon_output.txt) | |
echo "::set-output name=radon_output::$output" | |
- 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 | |
${{ steps.radon.outputs.radon_output }} | |
``` |