dependencies.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. name: Dependency Updates
  2. on:
  3. schedule:
  4. # Run every Monday at 9:00 AM UTC
  5. - cron: '0 9 * * 1'
  6. workflow_dispatch:
  7. permissions:
  8. contents: write
  9. pull-requests: write
  10. concurrency:
  11. group: ${{ github.workflow }}-${{ github.ref }}
  12. cancel-in-progress: true
  13. env:
  14. PYTHONUNBUFFERED: 1
  15. jobs:
  16. update-dependencies:
  17. name: Update Dependencies
  18. runs-on: ubuntu-latest
  19. timeout-minutes: 20
  20. steps:
  21. - name: Checkout repository
  22. uses: actions/checkout@v7
  23. with:
  24. # Use a Personal Access Token (PAT) named DEPENDENCY_UPDATE_TOKEN if
  25. # you want the created PR to trigger CI workflows (on: pull_request).
  26. # The default GITHUB_TOKEN suppresses further workflow runs on the PR.
  27. token: ${{ secrets.DEPENDENCY_UPDATE_TOKEN || secrets.GITHUB_TOKEN }}
  28. - name: Set up Python
  29. uses: actions/setup-python@v7.0.0
  30. with:
  31. python-version: "3.14"
  32. cache: 'pip'
  33. - name: Install system dependencies
  34. run: |
  35. sudo apt-get update
  36. sudo apt-get install -y build-essential libssl-dev libicapapi-dev python3-dev libpq-dev
  37. - name: Install pip-tools
  38. run: |
  39. python -m pip install --upgrade pip
  40. pip install pip-tools
  41. - name: Compile updated requirements
  42. id: compile
  43. run: |
  44. pip-compile \
  45. --upgrade \
  46. --output-file requirements.txt \
  47. requirements.in
  48. if git diff --quiet requirements.txt; then
  49. echo "dependencies_updated=false" >> "$GITHUB_OUTPUT"
  50. else
  51. echo "dependencies_updated=true" >> "$GITHUB_OUTPUT"
  52. {
  53. echo "diff<<DIFF_EOF"
  54. git diff -- requirements.txt | head -n 200
  55. if [ "$(git diff -- requirements.txt | wc -l)" -gt 200 ]; then
  56. echo ""
  57. echo "... (diff truncated to 200 lines)"
  58. fi
  59. echo "DIFF_EOF"
  60. } >> "$GITHUB_OUTPUT"
  61. fi
  62. - name: Install updated dependencies
  63. if: steps.compile.outputs.dependencies_updated == 'true'
  64. run: pip install -r requirements.txt
  65. - name: Run smoke tests
  66. if: steps.compile.outputs.dependencies_updated == 'true'
  67. run: |
  68. python - << 'EOF'
  69. import sys
  70. import os
  71. sys.path.insert(0, os.getcwd())
  72. try:
  73. from app import create_app
  74. from database.database import get_engine, create_dynamic_tables
  75. print("✅ Core imports OK")
  76. except Exception as e:
  77. print(f"❌ Import error: {e}")
  78. sys.exit(1)
  79. EOF
  80. - name: Run linting
  81. if: steps.compile.outputs.dependencies_updated == 'true'
  82. run: |
  83. pip install ruff
  84. ruff check . || echo "⚠️ Linting issues found"
  85. - name: Create Pull Request
  86. if: steps.compile.outputs.dependencies_updated == 'true'
  87. id: cpr
  88. uses: peter-evans/create-pull-request@v8
  89. with:
  90. token: ${{ secrets.DEPENDENCY_UPDATE_TOKEN || secrets.GITHUB_TOKEN }}
  91. commit-message: |
  92. chore: update dependencies
  93. Update pinned dependencies to their latest compatible versions.
  94. committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  95. author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  96. signoff: false
  97. branch: dependency-updates
  98. delete-branch: true
  99. add-paths: |
  100. requirements.in
  101. requirements.txt
  102. title: "chore: Update dependencies"
  103. body: |
  104. ## Dependency Updates
  105. This PR updates the pinned dependencies to their latest compatible versions.
  106. ### Changes
  107. - Regenerated `requirements.txt` from `requirements.in` with `pip-compile --upgrade`
  108. - Core import smoke tests passed
  109. - Linting checked
  110. ### Diff
  111. ```diff
  112. ${{ steps.compile.outputs.diff }}
  113. ```
  114. ### Testing
  115. - [ ] Manual testing of key features
  116. - [ ] Performance impact evaluation
  117. - [ ] Security review of new versions
  118. ---
  119. *This PR was created automatically by the dependency update workflow.*
  120. labels: |
  121. dependencies
  122. automated