Built the docker and succeed #32
This file contains hidden or 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: Pylint Code Analysis | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| pylint-check: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Pylint | |
| run: pip install pylint==3.3.5 | |
| - name: Run Pylint analysis | |
| id: pylint | |
| run: | | |
| # Run Pylint using project's .pylintrc and save output | |
| pylint_output=$(pylint --exit-zero --rcfile=.pylintrc mymodels/*) | |
| echo "Pylint output:" | |
| echo "$pylint_output" | |
| # Extract score and judge | |
| score=$(echo "$pylint_output" | grep -oP 'Your code has been rated at \K\d+\.?\d*') | |
| if (( $(echo "$score < 8.5" | bc -l) )); then | |
| echo "::error::Pylint score ${score}/10 is below the requirement (minimum 8.5 points)" | |
| exit 1 | |
| else | |
| echo "Pylint score ${score}/10 meets the requirement" | |
| fi |