release: IncidentRelay 2.1 #17
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: Quality | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "release/**" | |
| pull_request: | |
| branches: | |
| - main | |
| - "release/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| workflow-lint: | |
| name: GitHub Actions lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Run actionlint and ShellCheck | |
| run: | | |
| docker run --rm \ | |
| -v "${PWD}:/repo" \ | |
| --workdir /repo \ | |
| rhysd/actionlint:1.7.12 \ | |
| -color | |
| full-code-quality: | |
| name: Full code quality | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| INCIDENTRELAY_CONFIG_FILE: ${{ github.workspace }}/tests/incidentrelay.test.conf | |
| PYTHONPATH: ${{ github.workspace }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: | | |
| requirements.txt | |
| requirements-dev.txt | |
| requirements-quality.txt | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install \ | |
| -r requirements.txt \ | |
| -r requirements-dev.txt \ | |
| -r requirements-quality.txt | |
| - name: Check installed dependency consistency | |
| id: pip_check | |
| continue-on-error: true | |
| run: python -m pip check | |
| - name: Ruff full Python codebase | |
| id: ruff | |
| continue-on-error: true | |
| run: | | |
| ruff check \ | |
| --output-format=github \ | |
| app tests manage.py run.py | |
| - name: Ruff hygiene audit | |
| id: ruff_hygiene | |
| continue-on-error: true | |
| run: | | |
| ruff check \ | |
| --select F401,F541,F841 \ | |
| --output-format=github \ | |
| app tests manage.py run.py | |
| - name: Bandit full application codebase | |
| id: bandit | |
| continue-on-error: true | |
| run: | | |
| bandit \ | |
| -q \ | |
| -r app \ | |
| -ll \ | |
| -ii | |
| - name: Check all JavaScript syntax | |
| id: javascript | |
| continue-on-error: true | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| count=0 | |
| while IFS= read -r -d '' file; do | |
| echo "Checking $file" | |
| node --check "$file" | |
| count=$((count + 1)) | |
| done < <(find app/static -type f -name '*.js' -print0) | |
| echo "Checked $count JavaScript files." | |
| - name: Report code quality results | |
| if: always() | |
| shell: bash | |
| env: | |
| PIP_CHECK_OUTCOME: ${{ steps.pip_check.outcome }} | |
| RUFF_OUTCOME: ${{ steps.ruff.outcome }} | |
| BANDIT_OUTCOME: ${{ steps.bandit.outcome }} | |
| RUFF_HYGIENE_OUTCOME: ${{ steps.ruff_hygiene.outcome }} | |
| JAVASCRIPT_OUTCOME: ${{ steps.javascript.outcome }} | |
| run: | | |
| set -euo pipefail | |
| { | |
| echo "## Full code quality" | |
| echo | |
| echo "| Check | Result |" | |
| echo "|---|---|" | |
| echo "| pip check | $PIP_CHECK_OUTCOME |" | |
| echo "| Ruff | $RUFF_OUTCOME |" | |
| echo "| Ruff hygiene (advisory) | $RUFF_HYGIENE_OUTCOME |" | |
| echo "| Bandit | $BANDIT_OUTCOME |" | |
| echo "| JavaScript syntax | $JAVASCRIPT_OUTCOME |" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| failed=0 | |
| for outcome in \ | |
| "$PIP_CHECK_OUTCOME" \ | |
| "$RUFF_OUTCOME" \ | |
| "$BANDIT_OUTCOME" \ | |
| "$JAVASCRIPT_OUTCOME"; do | |
| if [[ "$outcome" != "success" ]]; then | |
| failed=1 | |
| fi | |
| done | |
| exit "$failed" |